5

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?

Mark
  • 1,277
  • 3
  • 13
  • 27

4 Answers4

7

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
Toby Speight
  • 27,591
  • 48
  • 66
  • 103
susodapop
  • 402
  • 4
  • 10
5

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.

Dave Zych
  • 21,581
  • 7
  • 51
  • 66
0

I simply copied the whole repository folder to Bonobo's repository folder and click on "Rescan directory" option from Bonobo admin Repositories page. It picked up the new repository as its own. May be Rescan directory option was added in recent versions.

Gautam Jain
  • 6,789
  • 10
  • 48
  • 67
0

I was able to add it by adding it on my Bonobo site first. Then I went to the Team explorer-> repository Settings and added the link from the site. After that I clicked on the master branch, on the bottom right hand side of the visual studio window and selected push. master push to bonobo.git

CaptonMike
  • 31
  • 5