简体   繁体   中英

How to pull code from other github repository (not fork) to my github repository?

I have two github repositoryes and I want to pull code from one to another with saving of commit history. How can I do that? Second is not a fork of the first unfortunately.

I don't believe there's a way to pull from one GitHub repo to another directly but you can totally do it manually.

First, pull from your first repo:

git pull

Second, add the second repo as a new origin:

git remote add origin2 <new_repo_url>

Finally, push to the second repo ( origin2 , that is):

git push -u origin2 <branch_name>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM