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 kenorb for Git push existing repo to a new and different remote repo server?

$
0
0

To push your existing repo into different, you need to:

  1. Clone the original repo first.

    git clone https://git.fedorahosted.org/cgit/rhq/rhq.git
  2. Push the cloned sources to your new repository:

    cd rhqgit push https://github.com/user/example master:master

You may change master:master into source:destination branch.


If you want to push specific commit (branch), then do:

  1. On the original repo, create and checkout a new branch:

    git checkout -b new_branch
  2. Choose and reset to the point which you want to start with:

    git log # Find the interesting hashgit reset 4b62bdc9087bf33cc01d0462bf16bbf396369c81 --hard

    Alternatively select the commit by git cherry-pick to append into existing HEAD.

  3. Then push to your new repo:

    git push https://github.com/user/example new_branch:master

    If you're rebasing, use -f for force push (not recommended). Run git reflog to see history of changes.


Viewing all articles
Browse latest Browse all 20

Trending Articles





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