I need to be able to add git credentials from my to my bash script but can't figure out how to do this.
git clone https://xxxxxxx
would ask for my username name and password.
how to i pass these in a bash script ?
any pointers would be appreciated
Or finding it via the Control Panel -> Manage Windows Credentials. Go to Windows Credentials -> Generic Credentials. Here your credential should be listed if everything is working correctly. Git should add it by default the first time you log in to a new repository.
For basic HTTP authentication you can:
Pass credentials inside url:
git clone http://USERNAME:PASSWORD@some_git_server.com/project.git
WARN this is not secure: url with credentials can be seen by another user on your machine with ps
or top
utilities when you work with remote repo.
Use gitcredentials:
$ git config --global credential.helper store
$ git clone http://some_git_server.com/project.git
Username for 'http://some_git_server.com': <USERNAME>
Password for 'https://USERNAME@some_git_server.com': <PASSWORD>
Use ~/.netrc
:
cat >>~/.netrc <<EOF
machine some_git_server.com
login <USERNAME>
password <PASSWORD>
EOF
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