ihue ihue - 1 year ago 195
Git Question

Not having to enter password for git pull in Ubuntu

I'm trying to by pass the password prompt every time I run

git pull

I'm running on Ubuntu. This is my Git config:

git config --list
user.name=Benlong Heng
credential.helper=cache --timeout=3600

I've been following this answer, and for some reason, I still keep getting the prompt after running
git pull

$ git pull
Enter passphrase for key '/root/.ssh/id_rsa':

Am I missing something? Any hints?

Answer Source

The answer you linked to is for HTTPS remotes, but this line in your config:


indicates you are connecting via SSH. The fact that you are being prompted for a password means that you have password-protected your SSH key. To cache your password for the current session, do:

eval $(ssh-agent)

You'll be prompted for your password once, and after that it will be cached.

If you don't want to be prompted for a password ever, then you'll need to generate a new key with no passphrase. I recommend against this, since anyone who gets ahold of that key file can impersonate you anywhere that you use the key.

Also, I noticed this:

Enter passphrase for key '/root/.ssh/id_rsa':

It's generally a bad idea to run as root, so I'd recommend switching to another user account at your earliest convenience. (If you don't want to use your own account for whatever reason, you can create a single-purpose account to use instead.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download