- Generate key
ssh-keygen
...
cp ./key-name* ~/.ssh
-
Go to GitHub repo and add key-name.pub
-
Clone repo using trick from this stackoverflow thread
ssh-agent bash -c 'ssh-add ~/.ssh/key-name; git clone git@github.com:user/proj-name.git'
- Open
~/.ssh/config
and add a block like this:
Host github-proj-name
HostName github.com
IdentityFile ~/.ssh/key-name
- Finally, open
.git/config
in your new repo and change the hostname in the git connection string like this:
git@github-proj-name:user/proj-name.git
Now you will be able to push/pull without password authentication.