Reputation: 179
I have a few (well three) Github repositories. I can push to two of them using my SSH key without requiring username / password. However, with the third, I get asked for my username/pwd every time.
Having looked here and elsewhere, the general advice seems to be that I am accessing github via http instead of SSH, so I followed the advice to set it to SSH.
These are the steps that I undertook:
1)
$ ssh -T [email protected]
Hi adent! You've successfully authenticated, but GitHub does not provide shell access.
(Note: No errors)
2)
$ git remote set-url origin [email protected]:adent/MyRepo.git
$
(Note: No errors)
But.... Trying a "push" still required my username/password, so I dug a little deeper and found this:
3)
$ git remote -v
MyRepo https://github.com/adent/MyRepo (fetch)
MyRepo https://github.com/adent/MyRepo (push)
origin [email protected]:adent/MyRepo.git (fetch)
origin [email protected]:adent/MyRepo.git (push)
This did not look right, so I checked the following:
4)
cd ~/my_other_project
5)
$ git remote -v
origin [email protected]:adent/MyOtherProject.git (fetch)
origin [email protected]:adent/MyOtherProject.git (push)
So... Am I right in thinking that github is still holding on to the HTTP form of access for MyRepo? If so, how do I fix it?
Thanks in advance for any help.
Upvotes: 1
Views: 125
Reputation: 4254
You could remove your deprecated remote url using HTTPS, add your SSH remote url and then change the upstream of your branch to the other one using SSH.
Doing as follows:
git remote remove MyRepo
To remove your deprecated HTTPS remote url.git remote add origin [email protected]:adent/MyRepo.git
To add your SSH remote url (Looks like you've already done this one)git push -u origin <branch_name>
To track your branch with the remote one.Upvotes: 1