Clone repository into GitHub

风格不统一 提交于 2019-11-30 11:26:14

问题


I have been using git locally for while a now and have a private repository with complete change history etc. I now want to share this on GitHub, so I need to clone from my local repo into a new GitHub repo. I cannot find any way to do this. How can I get all my history up onto GitHub?


回答1:


You don't need to "clone onto GitHub". You just have to create a repository on GitHub and push your changes there:

$ cd your_local_repo
$ git remote add origin git@github.com:USERNAME/REPO_NAME.git
$ git push origin master



回答2:


You simply want to create a new repository on your account on GitHub. Assuming your account name is CraigH, and you call you new repository NewRepo (imaginative, I know), you'd simply (assuming you have GitHub keys set up on your system properly):

  1. Add a remote to your local repository
    • git remote add origin git@github.com:CraigH/NewRepo.git
  2. Push out your current history to GitHub
    • git push --set-upstream origin master

And from that point, your history in the master branch are in GitHub's master branch.




回答3:


You do this by pushing to remote repo on GitHub. You should get the whole history and everything.



来源:https://stackoverflow.com/questions/10346810/clone-repository-into-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!