Anyone know how to set it up so when I'm in the command line and when I push/pull
to/from a git repository I don't have to type in my username and password?
Thanks.
Anyone know how to set it up so when I'm in the command line and when I push/pull
to/from a git repository I don't have to type in my username and password?
Thanks.
When you use
http/https
as your transfer protocol you will be asked forusername
&password
every time.Switch to ssh key and you will not be asked anymore.
The sample below is how to set the key for GitHub, but i will be same for most of the servers with a minor changes (GUI).
The process is still the same
git://
)Here is how to set it up:
Generate a new ssh key (or skip this step if you already have a key as you mentioned )
ssh-keygen -t rsa -C "your@email"
Once you have your key set in
home/.ssh
directory (orUsers/<your user>.ssh
under windows), open it and copy the content to the relevant section (ssh keys) under your central repository.For more information about the transport protocols read this:
Local-Protocol
The-HTTP-Protocols
The-SSH-Protocol
The-Git-Protocol
How to set up ssh key under your GitHub account?
Settings
)SSH keys and GPG Keys
New SSH key
Now it should work
Note
After the first set up open terminal and run a
git fetch
so the key will be tested and added to yourknown hosts
file.