Github push not picking up my ssh key only for a single repo

I have a couple of different repos that I access on GitHub. I have setup an ssh key and used it without any problem but for one repo, when I do a push I get a popup window asking for my username and password. That now fails (deprecated).

The really odd part is that the repo has a sibling repo under the same project I have no problems doing a push. It is only this one repo. So I know the ssh key is okay. It is like this particular repo is broken ssh wise. I am not sure how to fix it. I could blow it away but I have changes sitting on it waiting to be pushed out (though just a merge so I could redo it).

I would appreciate some guidance. Thanks.

Whether your Git operations use HTTPS or SSH depends on the URL configured for the repository. I guess you’ve been using SSH for all your other repositories, but HTTPS for the one that gives you trouble.

Easiest way to fix it: Find the SSH URL for that repository and run (assuming the remote name is origin, replace the example URL):

git remote set-url origin git@github.com:user/repo.git

Thank you!!! Spot on. I checked the origin and it was indeed https. I changed it over to ssh and it now works. Happy Friday!!!

1 Like