Reputation: 1167
I have a repository by name "helloworld" on the Github server - github.infra.com, But the submodules for this repository are from different Github servers.
Now I want to clone my "helloworld" repository recursively by passing the personal access token in the git clone command.
Something like this: git clone --recursive "https://x-token-auth:<token>@<repo_url>"
. This works iff everything is in single Github server.
But not in my case..! Could someone please help me here.
Upvotes: 6
Views: 3303
Reputation: 1324347
Don't try to pass those credentials directly on the command line: you can set them on your global config, and the git will use them.
Use the url.<base>.insteadOf
directive:
git config --global url."https://x-token-auth:<token>@<repo_url>".InsteadOf https://<repo_url>
git config --global url."https://x-token-auth:<token2>@<repo_url2>".InsteadOf https://<repo_url2>
Then do your git clone --recursive
.
Upvotes: 9