There are plenty of times when I’ve setup or cloned a project in HTTP originally, and then later, needed to connect via SSH. Here are the ways to modify it :
1/ When creating a project
- Using HTTP:
git remote add origin https://github.com/nickname/repository.git
- Using SSH:
git remote add origin git@github.com:nickname/repository.git
2/ Updating an existing project
- Open .git/config file, find the [remote “origin”] line;
- Change the url from :
https://github.com/nickname/repository.git
to :
git@github.com:nickname/repository.git
Of course, you must have your SSH keys registered in your Github/Bitbucket account.