'How to change origin in a SourceTree
I need to change origin for existing git repository. I am using SourceTree. I search a lot but has not fined the answer. Thanks!
Solution 1:[1]
Using Source Tree we can change the origin of our repository from the Settings option:
Edit the origin and save it
Solution 2:[2]
- First you have to add a new remote through 'Repository' -> 'Repository Settings...' -> 'Add' (Changing remote repository)
- Stay in the 'Repository Settings' menu and edit the current origin. Uncheck the 'Default remote' checkbox and rename the remote (e.g. old_origin).
- Now edit the new remote that was added in step 1 and check the 'Default remote' checkbox, the remote will be automatically named to origin.
Solution 3:[3]
If you just want a new origin or remote you can either. Click setting (on the top right of SourceTree) and go to the remote tab and add a new origin. Alternatively you could do this via the inbuilt terminal by running something like
git remote add origin https://github.com/user/repo.git
Solution 4:[4]
When you have two "remotes" (for example "origin" and "alternate") and you want to make "alternate" your default remote:
In the Settings (top right corner)
- First select "origin" and press the "Edit" button
- Rename "origin" to something else
- Remove the checkmark "Default remote"
- Press "OK" to store these changes
- Then select that "alternate" and press "Edit"
- Check the "Default remote" checkbox
- This automatically renames "alternate" to "origin" (that is why you had to rename your original "origin" first)
- Press "OK" to store these changes
- And press "OK" again to exit the Settings screen
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jorgesys |
| Solution 2 | Synck |
| Solution 3 | FullStack |
| Solution 4 | Hans Kesting |


