Quantcast
Channel: Git push existing repo to a new and different remote repo server? - Stack Overflow
Viewing all articles
Browse latest Browse all 20

Answer by gaborsch for Git push existing repo to a new and different remote repo server?

$
0
0

First, create your repo on Github. Then change directory to the checked-out source repository - suppose you want to push the master branch. You need to execute 5 simple steps:

git remote add origin2 https://github.com/user/example.gitgit checkout mastergit pullgit push origin2 mastergit remote remove origin2

This creates the link between your local repo and the new remote, check out and pulls the source branch (to ensure that it has the latest), then pushes the current branch, finally unlinks the local repo from the remote.

Your local repo will be intact after this, you can use it as before. If you need to push multiple branches, repeat the checkout-pull-push steps as many times as you need, just change the branch name accordingly.


Viewing all articles
Browse latest Browse all 20

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>