If you're running a Linux server an option is to use Git + SSH.
On The Server
Create a user account called git
which has permissions over your main git project directory. This is useful for allowing all collaborators to push on shared projects.
Add the RSA public key for each of your client machines to the authorized_keys
file on the server. (You can generate a private-public key pair using ssh-keygen -t rsa -b 4096
on most Linux distributions.)
Create a new bare repository for your project as the git
user. git init myproject --bare
On the Client
Turn on private key authentication by enabling the IdentifyFile
in your ssh_config
.
Clone the bare repository. git clone git@<server>:/var/git/myproject
Make your changes.
Commit the changes and push them back to the remote repo. git push origin master
If you need more specific instructions (such as the exact commands to create a user account) checkout the official Pro Git book.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…