1. Server setup The remote repository is actually no different from the local repository, it is purely for 24/7 operation and exchanging everyone's changes. GitHub is a remote repository that hosts open source code for free. However, for some commercial companies that regard source code as their life, they do not want to make the source code public, but are reluctant to pay protection fees to GitHub. In this case, they can only build a Git server themselves as a private warehouse. To build a Git server, you need to prepare a machine running Linux. Here we use CentOS. The following are the installation steps: 1. Download git-2.22.0.tar.gz https://Github.com/Git/Git/archive/v2.22.0.tar.gz Use Xftp to put the installation package on the server 2. Install git service environment preparation yum -y install curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel gcc cc 1) Unzip, switch to the location where the git installation package is placed, and unzip it tar –zxvf git-2.22.0.tar.gz 2) Switch directory cd git-2.22.0 3) autoconf 4) ./configure 5) Compile (please wait patiently for one minute) make 6) Installation make install 3. Add users adduser -r -c 'git version control' -d /home/git -m git After this command is executed, the /home/git directory will be created as the home directory of the git user. 4. Set a password passwd git Enter your password twice 5. Switch to git user su git 6. Create a git repository mkdir repo1 Create a warehouse folder git --bare init initializes the repository. Note: If you do not use the "--bare" parameter, an error will be reported when submitting the master branch after initializing the repository. This is because git rejects the push operation by default, so you need to add the following code to .git/config: [receive] denyCurrentBranch = ignore It is recommended to use: git --bare init to initialize the repository. 2. Connect to the server After the private git server is set up, you can connect and use it just like connecting to GitHub, but our git server is not configured with key login, so you need to enter a password every time you connect. 1. If you use TortoiseGit for synchronization, please refer to the following instructions. Use the command to connect: $ git remote add origin ssh://[email protected]/home/git/first This format seems different from the one we just used. It has a ssh:// prefix in front. Well, you can also write it like this: $ git remote add origin [email protected]:first If you use TortoiseGit for synchronization, refer to the above instructions. 2. Git bash here cloning step git clone ssh://[email protected]/home/git/repo1 IP address 192.168.25.156 /home/git/repo1 is the path plus the warehouse name Summarize This is the end of this article about building a private Git server on Linux. For more relevant content about Linux private Git server, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of vue.js dynamic components
>>: Exploration of three underlying mechanisms of React global state management
How to install Nginx in a specified location in C...
With a lot of CSS experience as a web designer, we...
Where is my hometown when I look northwest? How m...
The code looks like this: .process{ border:1px so...
Script requirements: Back up the MySQL database e...
1. Packaging Vue project Enter the following name...
I plan to realize a series of sticky note walls. ...
Table of contents Preface Quick Review: JavaScrip...
As shown below: def test_write(self): fields=[] f...
1. Achieve the effect 2 Knowledge Points 2.1 <...
Be sure to remember to back up your data, it is p...
I saw this question in the SQL training question ...
Preface Recently I encountered a deadlock problem...
systemd: The service systemctl script of CentOS 7...
Table of contents Preface 1. What is phantom read...