Switching Github origin from HTTPS to SSH not working

Viewed 1143

Super basic issue here, but I've been unable to find and forums that have my same issue. I'm trying to switch my local git repo from HTTPS to SSH but when I follow the documented steps:

$ git remote -v
> origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin  https://github.com/USERNAME/REPOSITORY.git (push)
$ git remote set-url origin git@github.com:USERNAME/REPOSITORY.git
$ git remote -v
> origin  git@github.com:USERNAME/REPOSITORY.git (fetch)
> origin  git@github.com:USERNAME/REPOSITORY.git (push)

This is how it goes for me:

E:\Example>git remote -v
origin  https://github.com/Kornosky/RotaryAnimation.git (fetch)
origin  https://github.com/Kornosky/RotaryAnimation.git (push)

E:\Example>git remote set-url origin git@github.com:Kornosky/RotaryAnimation.git

E:\Example>git remote -v
origin  https://github.com/Kornosky/RotaryAnimation.git (fetch)
origin  https://github.com/Kornosky/RotaryAnimation.git (push)

No matter what command I run, I can't get it to change to SSH. Additionally, I've removed all information from the git config file and I've run this command and many like it:

git config --global url.ssh://git@github.com/.insteadOf https://github.com/

Any suggestions? I've been pulling my hair out with this one. The end goal is to fix my issue of my pushes hanging. Which I've tried to diagnose by changing the HTTPS settings, but had no luck getting my files to push (no file is even near the 100MB individual file limit).

EDIT: It appears I can't switch to SSH even when I try making a new repo. Perhaps it could be an account setting?

2 Answers

I am able to successfully update my Remote URL using the commands provided.

I think you need put your username (Kornosky) and repository (RotaryAnimation) name in set-url command:

git remote set-url origin git@github.com:Kornosky/RotaryAnimation.git

I think it seted arilias.

can u check git global. file is ~/.git

Related