First we need to setup a user with a home folder. We will store all the repositories in this users home folder.
Rather than giving out the password to the git user account use ssh keys to login so that you can have multiple developers connect securely and easily.
Next we will make a repository. For this example we will work with a repository called example. Login as the user git and add the repository.
login to remote server
once logged in
That’s all there is to creating a repository. Notice we named our folder with a .git extension.
Also notice the ‘bare’ option. By default the git repository assumes that you’ll be using it as your working directory, so git stores the actual bare repository files in a .git directory alongside all the project files. Since we are setting up a remote server we don’t need copies of the files on the filesystem. Instead, all we need are the deltas and binary objects of the repository. By setting ‘bare’ we tell git not to store the current files of the repository only the diffs. This is optional as you may have need to be able to browse the files on your remote server.
Finally all you need to do is add your files to the remote repository. We will assume you don’t have any files yet.
replace REMOTE_SERVER with your server name or IP
原文出處:Netkiller 系列 手劄
本文作者:陳景峯
轉載請與作者聯系,同時請務必标明文章原始出處和作者資訊及本聲明。