Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git enter password before push/pull

Tags:

git

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

EDIT: 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

like image 466
marchinram Avatar asked Feb 23 '23 13:02

marchinram


2 Answers

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

ssh-keygen

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

ssh-copy-id user@host

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.

like image 23
Ryan Stewart Avatar answered Feb 26 '23 08:02

Ryan Stewart


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 protected]"

When prompted to enter a password when generating the key just leave it blank and hit enter.

like image 150
Chris Knadler Avatar answered Feb 26 '23 06:02

Chris Knadler