This can be changed by changing the authentication protocol method from https to ssh
One option would be to rename or delete the existing repo and then 'reclone' with the different method. So after mv
ing or rm -r
ing the current repo, the clone command will be something like
git clone git@github.com:user_name/repo_name.git
You can see the difference in the two approaches with the git config -l
command:
For https:
...
remote.origin.url=https://github.com/user_name/repo_name.git
...
For ssh
...
remote.origin.url=git@github.com:user_name/repo_name.git
branch.master.rebase=true # This was also created in the ssh method
...
You can see the difference in the .git/config
file for each repo:
Note the change in 'url' below. Plus addition of rebase = true
in ssh
http
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/user_name/repo_name.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
ssh
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:user_name/repo_name.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
rebase = true
So if you want to just change the authentication method without 'recloning' the entire repo you can just edit the projects .git/config
and change
url = git@github.user_name/repo_name.git
to
url = https://github.com/user_name/repo_name.git
plus add
rebase = true
at the bottom, in the "[branch "master"]
" section