How to clone git to a server?

What are the best practices for managing server-side git repositories?

  • In my dayjob, we have these very large (as in tens of gigabytes) git repositories that are part of the code base of the flagship application of the company. Due to the sheer size of the repository, we had to keep it on a Linux server which also serves as a build server. To edit a file we rsync or sftp the source files back and forth from our  machines to the server. As of compiling source files, we have special scripts that runs on the server and that is part of a distributed build system – which is another reason for keeping the repos in the server.. I find that basic git management becomes cumbersome since we had to resort to the command line for committing, branching, merging, and various other git tasks. Since the repositories need to be on the development server, GUI tools such as Sourcetree aren't available since these requires the repo to be on the local system. Cloning the repos to the local machine isn't much an option since the repositories requires a case-sensitive file system. Questions are:  - Are you experiencing a similar issue?  - Do you use any GUI tools for managing this kind of "remote repository"?  - What are your tips & tricks in coping up with a problem like this?

  • Answer:

    Well, you have not explained the fundamental problem which is preventing you from having local development trees.  Is 10G too large for your local systems due to disk space?  Is the 10GB the repo size or the working directory size or the combination of the two?  Have you done a `git gc [--aggressive]` on the server repo?  Is some operation too slow?  Could you use a network file system (than in combination with --shared or otherwise local filesystem linked git repos can save space)? In any case, one possible solution is to divide and conquer.  Use gitslave or git-submodules to split up your giant repositories into smaller ones.  People can clone the smaller repository that they are working on.  In the likely case that you have some large binary files, especially media file, committed into git, those are ideal candidates for splitting into a different repository and/or treating differently (see git-media and git-annex). In any case, I point you at  http://sethrobertson.github.com/GitBestPractices which discusses this among many other issues.

Seth Robertson at Quora Visit the source

Was this solution helpful to you?

Other answers

You may want to talk to someone at .  The problem with is: Free, can handle huge repositories, has "merge" that works well: pick two. (Perforce is not , Git is not good for very large repositories, Subversion has trouble merging.) "the repositories requires a case-sensitive file system" -- do you actually have files checked in that differ only by case? Otherwise either Perforce or Subversion should be able to preserve case, or you can map your local workspaces to avoid the problem areas of the codebase.

Don Marti

What does this huge size contain? Surely not all code? Sounds like BLOBs to me. I found this page that might help you: http://blogs.atlassian.com/2014/05/handle-big-repositories-git/. I would look at splitting the repository to http://git-scm.com/book/en/Git-Tools-Submodules. As for managing them I would look at a local installation of Gitlab or Gitorious. I have used Gitorious (my company still does) but I might opt for Gitlab now. You should still be able to use Git with a GUI. I prefer the command-line, but you could use some remote desktop application. I would recommend you look at your processes, though. We have a distributed build system as well and lots of scripts but that doesn't stop us from using local repositories. Only problem I can see is the case sensitivity if your desktop OS messes them.

Marko Poutiainen

It actually sounds like Git may not be the best fit for you. I know this is heresy in this Git-centric age, but the use case you're describing is where Subversion shines, assuming you're looking for a solution you can host yourself (or have hosted at a provider) with no licensing fees. Your working copy is only the section of the tree you need, so no cumbersome clones, and you can use a GUI. You can still export the relevant files to your build server as well, or keep a working copy on the build server and update that. I'm not well versed in this technique, but I imagine you could even use git-svn to have Git local repositories and a Subversion central host. There are ways, as others have described, to do this in Git as well, but if you find yourself jumping through hoops to use a particular tool, it may be time to consider a different tool.

Corregan Brown

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.