Configuration of SSH and HTTP in gitlab environment

Time:2021-2-23

After the gitlab environment is deployed, there are two ways to download gitlab code locally or remotely: SSH and HTTP

1) SSH: a relatively secure way, which requires uploading the local public key to gitlab: Profile Settings > SSH keys > add an SSH key

SSH mode can be used in three modes of gitlab
Window client sets SSH mode to connect to gitlab, refer to:http://www.cnblogs.com/kevingrace/p/5651402.html(introduction at the bottom of the article)

2) HTTP connection mode, only “public” public status can be selected
You can’t use HTTP to connect in private mode and internal private mode
HTTP direct connection to gitlab is not as secure as SSH connection, but you can also make some security settings, such as making port restrictions in the iptables of gitlab (port 8081 above) and adding a white list

git config --global  user.name  Wang Bo
git config --global user.email "ogs.com"
git clone http://gitlab.vin-inc.com/host.git

touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Note the permissions of members in the warehouse. If a gitlab user does not set the permissions of members, the GIT clone operation can be performed, but the GIT push operation will fail: remote: gitlab: you are not allowed to push code to protected branches on this project