-
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 git@github.com:OWNER/REPOSITORY.git (fetch) > origin git@github.com: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 "hacker3740@gmail.com"
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
$ cat id_ed25519
$ cat id_ed25519.pub
$ ssh -T git@github.com
$ 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 git@github.com:Hacker-Code-J/MyObsidianNote.git
origin git@github.com:MyObsidianNote.git (fetch)
origin git@github.com: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