How do I change Git remote URL?

You can use the git remote set-url command to change the URL of your remote. First, you will need to open Terminal (if using Mac or Linux) or the command prompt (if using Windows).

  1. Locate your project on your local computer. You can do this by running:
cd/path/to/repo
	
2. Then check and confirm a list of all of your existing remotes. To do this run this command:
git remote -v
For example, the output may look like something like this:

This list will contain your existing remote names and URLs. 
1.  Change the URL of the remote with the git remote set-url command:
git remote set-url origin git@accountname.git.beanstalkapp.com:/your-repository.git
		
This command tells git to change the URL for the remote, “origin” to be something different. 
For example: Let’s say you want to change your remote URL to be connect via SSH instead of HTTPS. You can tell git to set a new URL for the remote. In this example, we want to change our remote URL from:
https://ashleyharpp.git.beanstalkap.com/selfy-site.git
	
to
git@ashleyharpp.git.beanstalkapp.com:/ashleyharpp/selfy-site.git
	
To make this change, the command we’ll run will look like this:
Once done, you can verify that your remote URL has changed by running:
git remote -v
		
Now you have successfully changed your remote URL.

Still need help? Contact Us Contact Us