I have a project that I've been working on called "system" that I set up as a repo. I've been pulling and pushing to the project (system.git).
Now I want to publish it to a site like github. What is the best way to take my current project and push it into the new github project without losing my history?
Thanks!
Create the repo on Github.
Then you will set the origin to that project
git remote add origin [git hub url]
Then do a:
git push origin [branch name]
And you will push your local repository to Github (with all history etc)
This is really a reply to hacker's comment on the answer from ghills, but it got a bit long, and SO didn't like me putting a bunch of code in a comment.
...or you could use a name other than "origin". For instance, I have a repository in which my "master" branch pushes to one github repo, and the "hacking" branch pushes to another.
In .git/config, I have this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:xiongchiamiov/fourU.git
[branch "hacking"]
remote = origin
merge = refs/heads/hacking
[remote "main"]
url = [email protected]:xyztextbooks/fourU.git
fetch = +refs/heads/*:refs/remotes/main/*
[branch "master"]
remote = main
merge = refs/heads/master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With