By default everytime I push to github, I have a prompt asking for password.
(xgboost) guillaume@LL11LPC0PQARQ:~/git/guillaume_blog$ git push
Username for 'https://github.com': castorfou
Password for 'https://castorfou@github.com':
Everything up-to-date
Would be great if I could leverage ssh keys to authenticate.
Update remote from https to ssh
From https://stackoverflow.com/questions/14762034/push-to-github-without-a-password-using-ssh-key,
For example, a GitHub project like Git will have an HTTPS URL:
https://github.com/<Username>/<Project>.git
And the SSH one:
git@github.com:<Username>/<Project>.git
You can do:
git remote set-url origin git@github.com:<Username>/<Project>.git
to change the URL.
In my case I have
(xgboost) guillaume@LL11LPC0PQARQ:~/git/guillaume_blog$ git remote -v
origin https://github.com/castorfou/guillaume_blog.git (fetch)
origin https://github.com/castorfou/guillaume_blog.git (push)
I have just to modify:
git remote set-url origin git@github.com:castorfou/guillaume_blog.git
Results
It looks like working:
(xgboost) guillaume@LL11LPC0PQARQ:~/git/guillaume_blog$ git push
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.59 KiB | 812.00 KiB/s, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To github.com:castorfou/guillaume_blog.git
4013108..ae78b99 master -> master
Drawback: doesn’t work behing a firewall
{% include alert.html text=“To find a solution to use a proxy” %}
Here are 2 ways to be tested: https://stackoverflow.com/questions/1728934/accessing-a-git-repository-via-ssh-behind-a-firewall https://stackoverflow.com/questions/18604719/how-to-configure-git-to-clone-repo-from-github-behind-a-proxy-server?noredirect=1&lq=1