git installation deployment and use

git client control software

1. Install package
yum -y install git
git -version to see the version #

2. Setting up user information
git config --global user.name "wang"
git config --global user.email [email protected]
set the default compiler for vim
config git vim --global core.editor

3. Check the configuration
git config --list

git local operation

1. Create a directory initialization
mkdir DevOps
cd DevOps /
command becomes the catalog can manage Git repository
git init
to create a git repository
git init devops

2. Create a new file hello.py , and initialization files to the repository
echo 111> index.html
add the files to the staging area
git the Add hello.py
git Status check the status of #

3. The initialization file to the staging area warehouse
to the staging area for all content submitted to the branch
git commit -m "initialization warehouse"
git Status
Status is a clean work area
initialization is complete

4. Modify index.html and update it to a warehouse
222 echo >> index.html
git -AM the commit "to add a new row to the index.html"
git Status
Status is a clean work area

5. Delete inedx.html files from the library
to view the repository file
git ls-files
to delete the file into the staging area
git rm index.html
delete from inside the staging area
git commit -m 'delete index.html'

Use self-built server gitlab

The use docker start gitlib
need to prepare a 4g memory server
docker search gitlab
find Chinese mirror
docker pull gitlab Chinese Mirror

运行docker镜像
docker run -d -h gitlab --name gitlab -p 443:443 -p 80:80 -p 22:22 --restart always -v /srv/gitlab/config:/etc/gitlab -v /srv/gitlab/logs:/var/log/gitlab -v /srv/gitlab/data gitlab_zh:lates
Note: open gitlab use the 22 ports, remote ports need to change it

1. Enter gitlab interface operation
Firefox HTTP: // ip
first login forced to change the password for the root
click into the site menu bar - Tools icon to open the management area, create groups, use the group management and project members
to make public groups

2. Click the icon in the toolbar above the selected project to create a project

3. Create a user toolbar users the option of
editing can change the password again to create the user

4. The new user is added to the project
click group, the administrative privilege, the user will be newly added to a main programmer
5. gitlab copied to the public key
ssh-keygen
copy the public key information
cat ~ / .ssh / id_rsa .pub
in the top right corner of the interface to set up ssh keys
to copy the information into the secret key to create a secret key

Simple operation and remote users to upload new repository to gitlab

1. clone library
git clone git @ ip: group name / project name

2. Create a new file
cd / root / whsir / whsir
echo 11> 1.txt

3. The file is added to the repository
git add 1.txt

4. Submit file
git commit -m "New File"

5. associated with the remote repository
git remote add origin git @ ip: root / whsir.git

6. Finally push gitlab
Git Push Master Origin

Guess you like

Origin blog.csdn.net/m0_38139137/article/details/90599434