[root@hitlab ~]# mkdir rin
[root@hitlab ~]# cd rin/
[root@hitlab rin]# ls
[root@hitlab rin]# git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /root/rin/.git/
[root@hitlab rin]# ls -a
. .. .git
[root@hitlab rin]# ls .git/
branches config description HEAD hooks info objects refs
#设定用户信息
[root@hitlab rin]# git config --global user.name "rin"
[root@hitlab rin]# git config --global user.email "rin@rin.com"
#查看当前文件状态
[root@hitlab rin]# git status
位于分支 master
尚无提交
无文件要提交(创建/拷贝文件并使用 "git add" 建立跟踪)
[root@hitlab rin]# git status -s #简化输出
#查看原始密码
[root@hitlab gitlab]# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
# 2. Password hasn't been changed manually, either via UI or via command line.
#
# If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
Password: chTlakUevScMuwGe64w9+9hwZ06TqRY8IAGbrUwfY0U= #密码
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
登录:
设置密码
在gitlab中新建项目
cpp复制代码
#生成sshd密钥
[root@hitlab ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:PELuQkK7s3PJtp23wUg4u2AMDRiRq30d51yDvihcwsc root@hitlab.rin.com
The key's randomart image is:
+---[RSA 3072]----+
|oo |
|o. |
|o.. . . |
|.+ . +..o o |
|o.+.+o+*S. . |
|.o.++=E++. |
| *+o=o.o. |
| ..+B+..o. |
| .+ooo... |
+----[SHA256]-----+
[root@hitlab ~]# ls .ssh/
id_rsa id_rsa.pub
[root@hitlab ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDeP/9t71Q3xPp/89wxsr48+02qs26ajz58P2sLqsW8QnXI5drNOXutHqbDB51bbqk2RsdQAzeaSl0Ze+njvqxHDAcvXafjDlli0zBhjDDwIk7BP4XizcSYu1sOS6y1zqHTK88vdg/sc53xpE85Px2/ExFo3xfEipW40yRu96WoczIyYUwzqBc8P6t7XqqDyDS5JabrTkzqa0aAjwiWH6TlMoiSBcn/F21AQCRUObXmpMpucG4D+ZC6weV8QgK1mBbVUlKxPfZBf7dw2l8FAnXH0QS5vLVUDzT6hQ7DNnG9a4IfSKW3pedBeh0//83ctyRct2WaF3ByEbuvev0tXovHevivXf27a5pnr/nvOi1C4mGJdO7nMdj/KhxV5xDEECx2v2YcFbfjy0WQlXwhQJ5w/xRYCUotZbMdYZoupgKsrdOFUgXgg+VhUIbHG5MxKlNgBBS5P0IdXbroLLmq27KPzhguwMuxkfUvd1+88OKys7ESXuCO16M5CvcVGulJvj0= root@hitlab.rin.com
上传公钥到gitlab中
下载项目
cpp复制代码
[root@hitlab ~]# git clone git@172.25.254.220:root/rinleren.git
Cloning into 'rinleren'...
The authenticity of host '172.25.254.220 (172.25.254.220)' can't be established.
ED25519 key fingerprint is SHA256:tsP+LpnayZTuoWfrjH761t6k/+wJucVkeLPBeSoc3cE.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.25.254.220' (ED25519) to the list of known hosts.
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (3/3), done.
[root@hitlab ~]# ls -R
.:
./rin:
README.md rin.txt
./rinleren:
README.md
[root@hitlab ~]# cd rinleren/
[root@hitlab rinleren]# ls
README.md
[root@hitlab rinleren]# git remote -v
origin git@172.25.254.220:root/rinleren.git (fetch)
origin git@172.25.254.220:root/rinleren.git (push)
#文件提交
[root@hitlab rinleren]# echo rinleren > rinleren
[root@hitlab rinleren]# git add rinleren
[root@hitlab rinleren]# git commit -m "add rinleren"
[main 2f1bb98] add rinleren
1 file changed, 1 insertion(+)
create mode 100644 rinleren
[root@hitlab rinleren]# git push -u origin main
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 271 bytes | 271.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To 172.25.254.220:root/rinleren.git
6acfee2..2f1bb98 main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.
[root@jenkins mnt]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:q8YCccwb5lpas44wF6aHWarwmtL1l+WZjUCumyncD/I root@jenkins.rin.com
The key's randomart image is:
+---[RSA 3072]----+
| |
| |
| o |
| . * . |
| += o oS |
| B..B o.. |
|O.oO.*...= = |
|+B+.=o*=o = . |
|=.o..+E+. |
+----[SHA256]-----+
[root@jenkins mnt]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC9urMp8ZCy59ojdzui/COjifeLMdZavMQXPCSNMMPkl97T3cXQXc6SLXLezBl1PA/VJyY1SqYbEt96I9q1W/4G+Uh5Q9kUxBEAgt2iyh+wuJU9akl+iV4fRIpNXF/bq9cL1x1y5+27+QqJ4qxPn/A+0HWXEn69YUkmxu2zxONhD2WB9TOvFyZNms2AVEblZeTlZSIratp8iTHrcL6SmzveGOuRU7U8UAtiHRNfGctfeJ1vbcGiqEvX/GY9fPT5MccXrrYaW+gwYwGu+zjrniZN2JjkIVSjMx+UM3NCThBxUmzQXn63fV47eSBI0uS4aoAZaNX8kq3myeAmAgtnuu9+OZCFSn2XYyE9KXaQa52eAep62rrEdqphVgtRilwbW2zbOXWMJJh/EEWOrBSUerx/Q/SPr4ABTKQOPsK7Q3yJMnPs0dMMZqBVSTUW8GNXQ5M1Dmh0M2u/DrhTiOF479f5t0RAqmZPAnS7Z0+WaSGBYK2qhCjvlmxgtauG8PNVY5M= root@jenkins.rin.com