I've just started using Git for version control on a local network. To allow multiple users to sync repositories I've also started using the Bonobo Git Sever package which works well.
Up until now I've always initialised a repository by creating it in Bonobo, clone it down to a local directory, add files etc then push / pull as required.
Let's now say that I initially create the repository in a local directory, use it for a while and then want to add it to the remote sever, keeping all the commit history intact.
How do i do this? Is there an opposite to git clone - ie take an existing local repository and add it to the remote server?
Since version 6.0.0 of Bonobo Git Server, you can auto-create a repository on push. The setting must first be enabled by the admin user (it's off by default) and auto-create-on-push cannot come from an anonymous user.
git remote add Bonobo http://<your-username>@url-to-remote.git
git push Bonobo master
The ChangeLog doesn't provide much insight, sadly. If this doesn't work at first, take a look at the error logs in Bonobo's AppData/Logs folder.
Step by step instructions:
mkdir myFolder
cd myFolder
git init
type nul > someFile.txt
git add *
git commit -m "intial setup"
git remote add origin http://<your-username>@url-to-remote.git
git push origin master
You'll have to create an empty repository on the server. (make sure it's empty! Some servers will ask you to initialize with a README or .gitignore
or something - you don't want that.) Once you do that, get the url and add it as a remote
:
git remote add origin http://url-to-remote.git
Then do a push
:
git push origin master -u
This assumes you're pushing the master
branch. -u
specifies that your master
should "track" the master
on the server.
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