question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot update submodules in private repos requiring token

See original GitHub issue

Seems like there is no option to pass token in order to update submodules in the private repository… How could I pass a token?


import Git from 'simple-git';
  const git = Git(localDir);
await git.submoduleUpdate(['--init', upgrade.depName]);

For initial repo one could modify repo URL and add token there, but for submodules it doesn’t seem to work…

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
steveukxcommented, Jun 10, 2021

If your submodules have been added with an http based remote uri, the .netrc file will be picked up as usual when git is called by simple-git. You may need to check that there is a .netrc file configured for the user you’re running the nodejs script as.

To help finding issues with authorisation in the sub-module, you may want to enable git tracing

1reaction
steveukxcommented, Jun 10, 2021

Do you know how you would pass the token through if you were using command line git?

If you need to pass a custom header, use the per-command-configuration plugin:

import Git from 'simple-git';
const git = Git(localDir, { config: [`http.extraheader=Authorization: Basic ${token}`] });
// any command run through this `git` instance will now include the custom Authorization header
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot update submodules in private repos requiring token -
Seems like there is no option to pass token in order to update submodules in the private repository.... How could I pass a...
Read more >
git submodule update fails when using access token
I cloned a github repo I own into the VM. The repo contains a submodule. I ran git submodule init which returned: $...
Read more >
Git submodules cannot be checked-out / updated with CI token
One can add a git submodule update --init in the before_script , but this is insufficient. If you stick with SSH, you'll need...
Read more >
Private Repositories - Declarative GitOps CD for Kubernetes
Private repositories that require a username and password typically have a URL that start with https:// rather than git@ or ssh:// .
Read more >
Apps with submodules or private repo dependencies
Bitrise needs access to all repositories or submodules for a successful build, so if your app has submodules or private repo dependencies, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found