In your Git repository, run the command
git remote -v
to “verify” your remote repository definition.
This should show something like
~/Code/subQuery/projects/subql-starter$ git remote -v
origin https://github.com/seandotau/subql-starter.git (fetch)
origin https://github.com/seandotau/subql-starter.git (push)
To add another “origin”, run the command
git remote add origin1 git@github.com:<username/repo.git>
For example:
git remote add origin1 git@github.com:jimbob7/subql-helloworld.git
https://github.com/jimbob7/subql-helloworld.git
Note that you have to use a unique name. Now run remote -v again
~/Code/subQuery/projects/subql-helloworld$ git remote -v
origin https://github.com/subquery/subql-helloworld (fetch)
origin https://github.com/subquery/subql-helloworld (push)
origin1 git@github.com:jimbob7/subql-helloworld.git (fetch)
origin1 git@github.com:jimbob7/subql-helloworld.git (push)
To remove a remote, run
git remote rm origin1
Why would you want to do this?
You would want to do this if you are cloning from one repo and you want to push to another repo. Note that you need to have permission on the repo that you are pushing to so make sure the repo owner has given you (and you have accepted) the invitation.