Home > Tips & Tricks > How to Change Git Remote URL from HTTPS to SSH?

How to Change Git Remote URL from HTTPS to SSH?

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.

Being Tricky 😉

Photo of author

About Aman Mehra

Hey there! I'm Aman Mehra, a full-stack developer with over six years of hands-on experience in the industry. I've dedicated myself to mastering the ins and outs of PHP, WordPress, ReactJS, NodeJS, and AWS, so you can trust me to handle your web development needs with expertise and finesse. In 2021, I decided to share my knowledge and insights with the world by starting this blog. It's been an incredible journey so far, and I've had the opportunity to learn and grow alongside my readers. Whether you're a seasoned developer or just dipping your toes into the world of web development, I'm here to provide valuable content and solutions to help you succeed. So, stick around, explore the blog, and feel free to reach out if you have any questions or suggestions. Together, let's navigate the exciting world of web development!

Leave a Comment