Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install NAS with its own Git Server

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to install NAS with its own Git Server. I hope you will get something after reading this article. Let's discuss it together.

First, go to DSM, then find GIT SERVER in the suite center, download and install it.

The official DSM help Center for the use of GIT SERVER is as follows:

To allow users to use Git: log in to DSM using an account with administrative privileges. Go to the control panel > terminal and enable the SSH service. Please start the Git suite and select users to provide them with the ability to check in and check out files from the database. Note: through a shell tool called git-shell, Git users will be restricted to Git-related activities. This login shell will be applied to Git users to ensure that these accounts are used only for Git operations. Therefore, Git users can only use SSH connections to push and pull the Git repository and do not have full access to DSM. To create a Git repository: log in to the Synology server as root or admin through the SSH service. Change the directory to / volumeX (X is the volume number) to create a folder. For example, "git_repos". This folder will have the same permissions as Linux. Please run git init in this folder to create an empty repository. After creating the repository, Git client users can access the repository by entering the following command: git clone ssh:// [Git user] @ [your Synology server IP address or hostname] / [Git repository path]

Here are the concrete steps:

1. Log in to the server through the terminal (admin administrator account is required)

two。 Enter your disk volume. The general name is volumeX,X, which indicates the amount of disk space you have created. Generally, this machine has two hard drives, which is usually volume1.

Cd / volume1

3. Then create a git library directory

Sudo mkdir git_repos

4. And then create a test project inside.

Cd git_repossudo mkdir gittest

5. Then enter the test project directory and initialize the GIT

Cd gittestsudo git init-bare

Since the operation is performed by the root user, one of the most important steps is to change the owner of the entire directory of the treasure house to your git user

Chown-R admin:users git_repos

If you want other users to share, you also need to set the permissions of other users to writable.

Chmod-R 775 git_repos

At this point, the server is set up.

6. Enter the git command line on the client side and test whether it can be downloaded and uploaded.

Git clone ssh://admin@192.168.0.1:5122/volume1/git_repos/gittest

Then add a file locally and submit it to the local version library:

Echo "t1.txt" > t1.txtgit add t1.txtgit commit-m "add t1.txt" finally test the push to GIT SERVER and git push origin master shows success!

The simple steps are summarized as follows:

1. First create the project locally, there is a project directory

two。 Then execute git-- bare init in the local project directory to initialize.

3. Then submit the documents that need to be submitted locally

4. Then COPY the project directory to the server, only the COPY .git directory is fine, and other working directories do not use COPY.

5. It can be pushed to a remote server locally.

There is another way:

If git init is used for local initialization, there will be problems with the push. The solution is to COPY all local directories to the server. Then execute under the corresponding directory of the server:

Git config-- bool core.bare true then deletes all files and directories except the .git directory. So that the local can be successfully pushed. Of course, it is also possible to export the naked library directly using git clone-- bare hello hello.git, and then upload the hello.git directory directly to the server. But the address needs to be added with the directory of hello.git. After reading this article, I believe you have a certain understanding of "how to install Git Server with NAS". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report