I am using git to clone a repo via https thus:
git clone https://username:password@alocation/git/repo.git
This is fine but it has a large number of subrepos to clone as well so I am using the --recursive
option.
Problem here is that for the top level it takes the username & pass specified but for each sub repo it asks for the details again so I get the following:
C:>git clone --recursive https://username:password@alocation/git/repo.git
Cloning into repo...
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15 (delta 8), reused 0 (delta 0)
Unpacking objects: 100% (15/15), done.
Submodule 'sub1' (https://alocation/git/repo.sub1) registered for path 'sub1'
Submodule 'sub2' (https://alocation/git/repo.sub2) registered for path 'sub2'
Submodule 'sub3' (https://alocation/git/repo.sub3) registered for path 'sub3'
Submodule 'sub4' (https://alocation/git/repo.sub4) registered for path 'sub4'
Cloning into sub1...
Username:
Password:
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 10 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (10/10), done.
Username:
..............................etc....
Can I give the username & password separably so I don't have to enter each time.
Obvious use case is for a deep subrepo structure like this where there are lots of files. Entering the same data for each subrepo is going to get tedious & error prone.
Your username should be simple enough to remember but hard to guess. Never use easy-to-guess numbers with your usernames (for example, address or date of birth). Don't use your Social Security number or ID number as your username. If you're struggling, try an online username generator.
Alternatively referred to as an account name, login ID, nickname, and user ID, username or user name is the name given to a user on a computer or computer network. This name is commonly an abbreviation of the user's full name or his or her alias.
What is a unique username? A unique username is one that stands out among the others. In most cases, such usernames include numbers, uppercase and lowercase letters, and special characters. In quite a few cases, unique usernames are at least 10 characters long.
The credentials should be valid for any submodules with an address supposed to accept them.
One only case where it could fail is when the .gitmodules file points to another repo, as illustrated by the case 214 of the Hunch Kod project.
To make sure those credentials are passed to every request to 'alocation' server, you don't need to tweak anything in Git, but this is probably a ssh, curl or http proxy settings.
I would rule out ssh (alocation wouldn't execute anything as 'username' but would rather have a dedicated user account).
Check your http_proxy and https_proxy environment variable if you have a proxy.
But try also a simple curl https://alocation/git/repo.git
:
With a $HOME/.netrc
(%HOME%\_netrc
on Windows), you can specify the login/password expected.
machine alocation
login username
password mypassowrd
If that work for https://alocation/git/repo.git
(i.e. without asking you for a username and password), it will work for any other repo( here submodules).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With