Configuring the version management service in the NAS at home can greatly facilitate the daily work of the SOHO family. This article demonstrates how to configure the git server service in a Synology nas
Install Git Server suite
In the Synology Nas suite, the Git Server is already included. we need only install it.
In Synology Nas suite window, search ‘Git Server’ in all suite tab, then install it.
After installation, you need to choose which users can use the git server.
Create Git repositiry
To set up a Git repository on a NAS, we first turn on the SSH function of the NAS. Then use ssh to log in to nas to set it up.
Let’s take the example of setting up a repository for Java SE projects to demonstrate the entire process and related commands: (Suppose the repository to be built is named javase)
Log in to the NAS with ssh
Switch to the /volume1/GitRepos directory and create a new one if it does not exist
- Create a folder for repository
- Enter the folder
- Initial reposiory
Execute the following commmand:
git --bare init
- Change the permission of the folder.
chown -R xxx:xxx javase.git
Steps 6 is mainly to assign permissions to the directory, which in my NAS can be omitted because the logged-in user is directly authorized
Use the git client to access the repository
On the client side, you can use the following url to clone the repository:
git clone ssh://email@example.com/volume1/GitRepos/javase.git