I have a repository that I have already cloned on my computer using https
. I want to set up this repository as ssh
so that I don't have to enter in my username and password every time I git push.
Any suggestions on how I can convert this https
cloned repository to ssh
without having to actually re-clone it, so that I may avoid entering my credentials all the time?
There is a pretty good documentation from GitHub:
https://help.github.com/en/articles/changing-a-remotes-url#switching-remote-urls-from-https-to-ssh
In short, this should do it:
git remote set-url origin [email protected]:PATH/REPOSITORY
You should remove your HTTP remote (for example with origin
):
git remote remove origin
and add the SSH remote instead
git remote add origin [email protected]:path/to/project.git
You will then also have to set the branch's remote again with
git push -u origin master
or
git branch --set-upstream-to=origin master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With