开发者

How do I start a new repo on github with an existing project?

I built out a project and have been pushing it to git hub. I then made a copy of the folder (on my local machine) and started going in a different direction with it. I created a new repo on github but it won't let me push the changes because it still thinks it's part of 开发者_开发百科the old repo. When I go to change the name, it resets the files on my local machine back to the previous repo! Good thing I saved a copy before trying this.

Basically what I want to do is start a new repo on github with my current project but keep all the git revisions I did in the past. Is this possible?


I think you must first have to remove your reference to the old repository: (in this case origin is the name of the reference to github)

git remote rm origin

And add the new reference:

git remote add origin git@github.com:.....

And then push all the commits from your local repository to github

git push origin master


I think what you want is to create a branch:

 git checkout -b MyNewBranch

then you want to add a new remote to your new github repo:

git remote add new_remote  <path_to_new_github>

Finally when you push from the branch use

 git push new_remote MyNewBranch 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜