Changing A Git Repository's Origin Settings26 November 2019
Photo: Unsplash - Luke Chesser
This week I completely managed to screw up some git settings for a project. I learnt that you can simply update the origin when using a service such as Gitlab/Github/Bitbucket. This can be useful as well if you are transferring code or repository ownership.
Firstly you need to see what remotes you have configured with:
This will output a list of the configured remotes such as;
There are two remotes configured based on where to fetch from and where to push to.
If you are not using ssh your output will almost certainly be based on https:
To update the remotes you first remove the existing entry:
So if the example we are using it would be:
You can then add the new remote details using:
In our example that might look like: