On a Linux server
The first step is to create an account that is specific to Git's warehouse, which is also easy to manage. You can refer to the Linux New User command for this article.
#新建一个git用户组
sudo groupadd git
#新建一个git用户, create a directory, and prevent shell logins from being added to the GIT user group
sudo useradd git-m-s/sbin/nologin-d/home/git-g git
The second step is to create a new git warehouse, called Git bare repository, which is the repository for git.
$ mkdir Repo.git
$ chown-r git:git repo.git #改权限
$ CD Repo.git
$ git--bare init
Initialized empty Git repository in/home/ams/repo.git/
This warehouse is not the same as the local one, you can find that the local warehouse has a. Git directory under Project, and Project has its own code. But this git bare warehouse it doesn't have its own project, and he only has the same content as the local. Git directory.
Under the client
Using the Tortoisegit graphical interface, use the portable git kernel.
The first step, right-click Directory, select Git clone, and then set as diagram
The second step, after the confirmation, will come out a password prompt box, lets enter the password.
The third step is to wait for the download to end so that there is a local repository locally.
Summary: Such a simple git private warehouse is built, local can continue to submit code to the server, but also requires a password.