Http://www.cnblogs.com/xl19862005/archive/2011/06/28/2092464.html
Original
If you have a ready-made git repository and want to put it on the gitserver for use by the Team (for example, you clone an official kernel repository and want to use it internally as the basic repository), what should you do. First, you need to get a pure Repository from your work warehouse. For example, your work directory is ~ /Kernel: You want to export the pure repository to your USB flash drive and copy it to gitserver. $ Git clone-bare ~ /Kernel/Media/udisk, then take the USB flash drive and hand it to the gitserver administrator to copy it to/home/repo/and configure gitosis configuration files, you don't need to talk about this anymore. For example, download the Alsa Library: git clone git: // android.git.kernel.org/platform/external/alsa-lib.gitgit clone git: // export clone-bare ALSA-lib alsa-lib.gitgit clone-bare ALSA-utils alsa-utils.git move the bare Library to the GIT Server Directory CP alsa-lib.git/home/repo pay attention to changing the owner to get commit permissions. Chown-r git alsa-lib.git and then O, huh.
However, the following errors may occur:
Initialized empty git repository in/home/Norton/work/test/box_client/. Git/
Fatal: 'repositories/box_client.git 'does not appear to be a git Repository
Fatal: the remote end hung up unexpectedly
Conclusion: The pure repository created by servera cannot be cloned when it is obtained to serverb. However, the local pure repository is acceptable. For example, after serverb clone servera, it is possible to create a pure repository B and put it in the gitosis repository.
Method 1: I clone the next database from server a, And I modified it on this basis. Then, a pure repository is generated and copied to the version repository of my server, you want to copy the new version directly from the client. This is not feasible for the time being.
However, after I clone the client code on the server, I create a pure repository for the server version. The same repository can be cloned by other clients.
Method 2: Clone the servera project in serverb, and then push the local repository in serverb.
In the cloned project, perform the following steps:
Su switches to administrator permissions first.
Git remote add local/home/repo/test. Git creates a remote branch pointing to a local repository
Git pushes the local master to execute the push operation.