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
First, the structure inside the nginx container: ...
Slideshows are often seen on web pages. They have...
1. Background Buttons are very commonly used, and...
There are two ways to delete data in MySQL: Trunc...
Table of contents UNION Table initialization Exec...
Apache Superset is a powerful BI tool that provid...
As shown below: select a1,a2,a1+a2 a,a1*a2 b,a1*1...
On Unix-like systems, you may know when a command...
Building an image is a very important process in ...
This article shares the specific code for JavaScr...
Effect html <div class="sp-container"...
Table of contents Preface 1. Array traversal meth...
1. Compatibility As shown below: The compatibilit...
This article uses an example to describe the erro...
body{font-size:12px; font-family:"宋体";}...