Multiple git origin remote url to push code to multiple git repository


November 12, 2018 2 minutes git , git remote url , multiple repo

I have stored a project in my bitbucket. At the same time I wanted to keep these code in my github account so by adding multiple git remote origin url I am able to push code to different code repo.

following command for adding remote

git remote set-url --add --push origin https://github.com/username/projectname.git
git remote set-url --add --push origin https://username@bitbucket.org/username/project.git

If you need to delete origin

git remote remove origin

Once you have delete origin you might need to add remote url again

git remote add origin https://github.com/username/projectname.git

if you want to change your remote origin in some point

git remote set-url origin https://github.com/username/projectname.git

See Also