-
Open Terminal.
-
Change the current working directory to your local project.
-
List your existing remotes in order to get the name of the remote you want to change.
$ git remote -v > origin [email protected]:OWNER/REPOSITORY.git (fetch) > origin [email protected]:OWNER/REPOSITORY.git (push)
-
Change your remote's URL from SSH to HTTPS with the
git remote set-url
command.git remote set-url origin https://github.com/OWNER/REPOSITORY.git
-
Verify that the remote URL has changed.
$ git remote -v # Verify new remote URL > origin https://github.com/OWNER/REPOSITORY.git (fetch) > origin https://github.com/OWNER/REPOSITORY.git (push)
$ cd ~/.ssh
$ ls ...
ssh-keygen -t ed25519 -C "[email protected]"
ssh-keygen -t rsa -b 4096 -C "[email protected]"
$ cat id_ed25519
$ cat id_ed25519.pub
$ ssh -T [email protected]
$ git remote -v
origin https://github.com/Hacker-Code-J/MyObsidianMemo.git (fetch)
origin https://github.com/Hacker-Code-J/MyObsidianMemo.git (push)
$ git remote set-url origin [email protected]:Hacker-Code-J/MyObsidianNote.git
origin [email protected]:MyObsidianNote.git (fetch)
origin [email protected]:MyObsidianNote.git (push)
Alternate Ports: If your network is blocking port 22, GitHub also supports SSH connections through port 443. You can modify your SSH configuration to use this alternative port by adding the following lines to your ~/.ssh/config
file:
$ ~/.ssh
$ touch config
$ nvim config
Host github.com
Hostname ssh.github.com
Port 443
User git
$ cat config