git enter password before push/pull
Our company is using git for source control and on my machine I can push and pull to the server without entering a password everytime, however one of my colleagues has to repeatedly enter a password which is very annoying, does anyone know how to fix this?
Thanks in advance
We are not using github and we already have the ssh public keys from all the users in the authorized_keys file in the .ssh folder in the git user home directory. I didn’t do anything special for my computer, just added the ssh key like the other computers, yet I am the only one who doesn’t have to repeatedly enter the password
4 Solutions collect form web for “git enter password before push/pull”
This is probably done by setting a password when generating your id_rsa key pair. There is some documentation on github about how to set this up with a password. If you wanted to up your key pair without a password then do the following commands.
cd ~/.ssh ssh-keygen -t rsa -C "email@example.com"
When prompted to enter a password when generating the key just leave it blank and hit enter.
It depends on whether it’s asking for a password or passphrase. I’d guess it’s the latter. In that case, it means the keypair that’s being used for authentication was created with a passphrase. If that keypair isn’t used for anything else, it’s safe to just generate another and overwrite it using
followed by pressing Enter three times. If you don’t want to overwrite an existing one, let me know, and I’ll tell you about the options there.
Then, whether it was originally asking for a password or passphrase, you’ll need to add the public half of the new keypair, located at ~/.ssh/id_rsa.pub, to the git server you’re trying to push to. If it’s a gitosis or gitolite server, which it probably is, you’ll have to give the public key to someone who has admin permission so they can add it to the server. If it’s just a plain Linux box with a normal git repo on it (probably not), you can use
It will ask for your password this time, but not again thereafter.
That should cover the most likely scenarios. If it seems to not, give me more details, and I should be able to help you out.
The other option is to keep the password on your key but use
ssh-agent to store the password for the duration of a session.
You will want to add his public key to the authorized_keys file which is located in that git user’s ~/.ssh/authorized_keys file.
- Make sure he has an ssh-key file created
scp git_user@servername:~ id_rsa.pub
- ssh into the server as that git user: ssh git_user@servername and enter password.
cat id_rsa.pub >> authorized_keys
That will add his key to the authorized keys and he shouldn’t have to enter a password.