In this trick, I will show you how you can change the Git remote URL from HTTPS to SSH. It is very simple, you just have to run the one command to convert the HTTPS URL to SSH.
To switch Git remote URL from HTTPS to SSH, first, you need to check the available Git URL in your cloned repository project folder, so you can copy the URL to use it in command.
Run the following command to check the available Git remote branch URLs.
The above command will give the results like the following URLs.
Switch Git Remote URL from HTTPS to SSH
Now we will change the Git remote URL from HTTPS to SSH using the Git command. The command is git remote set-url
. This command takes two arguments origin and repo URL.
Simply open your terminal or Git Bash in your local project folder and run the following command to switch the Git remote URL to SSH from HTTPS.
It will switch your Git repository remote URL from SSH to HTTPS. Now you can continue on your project. But before starting working on this repository please verify the changed URL by running the following command.
Now it will give you the following SSH URLs as result.
See Also: How to Delete Git Branch – Locally and Remotely?
Being Tricky 😉