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
Table of contents Preface 1. Basic Data 2. Inheri...
binlog is a binary log file that records all DML ...
Article mind map Why use master-slave replication...
Application Scenario Taking the background manage...
Scenario 1: Html: <div class="outer"...
This article introduces some issues about HTML ta...
After installing Docker, I encountered the x509 p...
function 0. Display current time Command: select ...
This article mainly introduces the installation/st...
The complete code is as follows : HTML code: Copy ...
Possible solutions 1. Math.random generates rando...
1. Introduction When the amount of data in the da...
Background Recently, when writing SQL statements,...
The solution to the problem that Ubuntu 18.04 in ...
Preface Because the mini program upload requires ...