Build a git code warehouse in centos7
Preface
In the past, when developing my own personal applets, I have always used SVN
it as a version control system for the code, but SVN
there is a more obvious disadvantage of using it. The code is managed in the way of a central warehouse, which can only be used when it is connected to the Internet. . And in our daily learning and development is a spiral development process, we need a code control system that is easier to achieve multi-version coexistence.
For the use of Git, please refer to my blog: How Git uploads its own local branch code to the remote master branch
text
Git
Git is a free and open source distributed version control system designed to handle everything from small to large projects quickly and efficiently.
The difference between SVN and GIT :
GIT
It is distributed, andSVN
is centralized.GIT
The content according to metadata stored, andSVN
is based on the file : Because the directory is in a git clone of the repository on a personal machine, it has all the stuff on the central repository, such as labels, branch, version records.GIT
Branches andSVN
branches are different :svn
branch omissions will occur, andgit
you can quickly switch between several branches in the same working directory. It is easy to find unmerged branches and merge these files simply and quickly.GIT
There is not a global version number, butSVN
there is.GIT
The integrity of the content is better thanSVN
:GIT
The content storage uses aSHA-1
hash algorithm. This can ensure the integrity of the code content and reduce the damage to the repository in the event of disk failures and network problems.
Build a git code warehouse in centos7
1. Install git
sudo yum install git
After installation, check the git
version
2. Create a dedicated server account for git
useradd
: Createcentos
userpasswd
: Set a password for this user
useradd luo
passwd luo
3. Create a new git repository
Step 1: Create a folder
mkdir -p /usr/local/mygit/dubbodemo.git
Step 2: Create a new git
bare library
cd /usr/local/mygit/dubbodemo.git
git init --bare
Step 3: Modify permissions
chown -R git:git ../dubbodemo.git
chmod -R 775 ../dubbodemo.git
chmod g+s -R ../dubbodemo.git
4. Use the git client tool to pull or upload the code.
Here is sourcetree
an example:
Step 1: Configure the git
warehouse
Step 2: Pull the git
warehouse