Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git/Bonobo - Add local repository to remote

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?

like image 487
Mark Avatar asked Sep 18 '15 22:09

Mark


2 Answers

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:

  1. create your folder mkdir myFolder
  2. enter your folder cd myFolder
  3. initiate the git repo git init
  4. create a file or the desired folder content type nul > someFile.txt
  5. add changes to the repo git add *
  6. commit changes git commit -m "intial setup"
  7. add remote git remote add origin http://<your-username>@url-to-remote.git
  8. push remote git push origin master
like image 81
susodapop Avatar answered Oct 08 '22 20:10

susodapop


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.

like image 34
Dave Zych Avatar answered Oct 08 '22 21:10

Dave Zych