I\'ve been somewhat \'putting up\' with Github always asking for my username and password when I clone a repository. I want to bypass this step because it is an annoyance w
If you are using ssh url for git, when prompted for password for ssh put the username as "git" and the password as your system's login password
Make sure you are using ssh for your repository also
mahtab@mahtab-Lenovo-G50-70:~/my-projects/jenkins-cje-2017$ git remote -v
origin git@github.com:eMahtab/jenkins-cje-2017.git (fetch)
origin git@github.com:eMahtab/jenkins-cje-2017.git (push)
Don't use https, if your remote is using https then it will keep asking for password, even If you have added the public key to Github and added private key to ssh-agent. Below will always ask for password
mahtab@mahtab-Lenovo-G50-70:~/my-projects/jenkins-cje-2017$ git remote -v
origin https://github.com/eMahtab/jenkins-cje-2017.git (fetch)
origin https://github.com/eMahtab/jenkins-cje-2017.git (push)
Try ssh-agent
as it is explained there : https://help.github.com/articles/working-with-ssh-key-passphrases
Worked in LinuxMint/Ubuntu
Do the following steps
Step 1:
Goto file => /.ssh/config
Save the below lines into the file
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile /home/apple/myssh-privatekey
AddKeysToAgent yes
Don't forget to add this line AddKeysToAgent yes
Step 2:
Open the terminal and add the keyset to the ssh-add
$ ssh-add -k /home/apple/myssh-privatekey
provide the passphrase.
If you're using windows, this worked for me:
eval `ssh-agent -s`
ssh-add ~/.ssh/*_rsa
It'll ask for passphrase in the second command, and that's it.
I recently upgraded to macOS Mojave, and installed some tools via homebrew, which seemed to swap Apple's version of ssh-add
for the different one. My default version of ssh-add
did not have the -K
option. This led to the following error:
# ssh-add: illegal option -- K
You can see which version of ssh-add
you have by running which ssh-add
.
(Mine was stored in /usr/local/bin/ssh-add
)
To fix this, I had to point the key to Apple's version:
/usr/bin/ssh-add -K ~/.ssh/id_rsa
Git/GitHub worked perfectly afterward. For more information, see: Error: ssh-add: illegal option -- K