Reputation: 3344
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?
Upvotes: 22
Views: 17618
Reputation: 11
You can "reverse clone" your local repo (or remote, it doesn't matter) "old_repo" into a new, already created, github repo "new_repo", with all its branches and tags, like this:
Source: https://docs.github.com/en/repositories/creating-and-managing-repositories/duplicating-a-repository
Upvotes: 1
Reputation: 12839
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):
git remote add origin [email protected]:CraigH/NewRepo.git
git push --set-upstream origin master
And from that point, your history in the master
branch are in GitHub's master
branch.
Upvotes: 6
Reputation: 1054
You do this by pushing to remote repo on GitHub. You should get the whole history and everything.
Upvotes: 0
Reputation: 22780
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 [email protected]:USERNAME/REPO_NAME.git
$ git push origin master
Upvotes: 41