注意:可见的级别并不是和该项目的权限一一对应的。比如,可以访问Intelnal project,但并不意味着可以在该项目上进行删除、添加文件等操作。仅代表你可以刻隆该项目,查看问题等。
进入项目视图—-点击编辑按钮—-改变可见级别选项。
主机名称: C7201 ——–Gitlab服务器
C7202 ———模拟Gitlab服务器客户端
首先来检查一下是否已经存在ssh key。 执行以下命令来检查是否有文件id_rsa.pub或者id_dsa.pub.
ls ~/.ssh
[root@c7202 ~]# ssh-keygen -t rsa -C "Comment for key"
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:zihLgXaDZXunp3BJP7uWH+gep1s0fMEnZXV9dzDcqlM Comment for key
The key's randomart image is:
+---[RSA 2048]----+
| .=++|
| . o..B|
| o + ..+|
| = . . +E |
| + = o S + .o |
| . . = O o oo |
| + = O.+ . |
| . = +oB . |
| . .oB+. |
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/mike/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/mike/.ssh/id_rsa.
Your public key has been saved in /c/Users/mike/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:us30pESKeTghRu8MfEMnX+WZJ4M+FjA5sqNrWuIKKIA mike@win10-001
The key's randomart image is:
+---[RSA 2048]----+
| o. . |
| . oo + o |
| . oo..+ * . |
|.o oo+ o . + |
|E =.=.. S |
|o..* * = . |
|= ..B + o . |
|+oo o * + |
|++ . + . |
LINUX上查看公钥内容:
[root@c7202 ~]# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCugkcsdX4qe4cc5HjryGY7judYrqV4B688z3As1NYE/Pbn/RjFRmCzgKSzWRp7EN3SSMoN5yfdq84DUJ3lzzUC0k6+x7lL8Ma3uNMbpzLwdfGLWjMo0wB6ZIBuNEEgyfrfOg1xI9MWhaZKRlEKAW8ibhrx5GPojWbZHPDxy1y9a8Qsnufkqu1NgM9vnu8y2NWqFXGrZwbl8LAsCGwYr9JIqR5DJNklnNV5oWCZpdVtjeRljUPlPmF7d6+k7mrEdxIdhr7vtM6d1G1wBVqYv7DpMBZGy49xBT+V3fM66lOMO0wfTM4gTQQDvysWtchv2RzP1ViYuSrI94851OENxd2r Comment for key
WINDOWS 查看公钥内容:
$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4xHkRoc9QuEwdojNtB7Q1yRVF2PxsHeNdfAuMKnl2mqxoFKE3XXvKMyAm6ZKWxMeeuVB81lVB0xqkUKfOCCioMF/dtSglpnCWW4sxWVPSRPLD5NbY3Em3By7a/QuaYwe1O32kD6QdlPZrBuddbCh1gbUw5F46ta1X2qD3QWRC0J1ohv0SzH96b3U3bxyl/foCarLl7ZWIhe27+n/JX6KPDi/Hnmp7+Tz2w9wbnbcY31TDVgz9gg1d8UrO0ARramW+Ba5d4SPeV5z8HJwttxUjtf8HNBwKWZUgXOrUsMmj/+ZI5oYge3U2YWGUdqJxFcZRwOB/Lrhf4h6XBguv7cg1 mike@win10-001

mike@win10-001 MINGW64 ~
$ mkdir super-git
mike@win10-001 MINGW64 ~
$ cd super-git/
$ git init
Initialized empty Git repository in C:/Users/mike/super-git/.git/
mike@win10-001 MINGW64 ~/super-git (master)
$ echo "HELLO README" > README.md
$ git add README.md
mike@win10-001 MINGW64 ~/super-git (master)
$ git commit -m "Our first commit"
[master (root-commit) d6c9c4a] Our first commit
1 file changed, 1 insertion(+)
create mode 100644 README.md
mike@win10-001 MINGW64 ~/cookbook
$ git clone [email protected]:root/cookbook.git
Cloning into 'cookbook'...
The authenticity of host 'gitlab.aishangwei.net (192.168.2.201)' can't be established.
ECDSA key fingerprint is SHA256:HvXTteW8UQ0MtxDAlMhL9XNOElAVV69d8nDsWjixrXI.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.aishangwei.net,192.168.2.201' (ECDSA) to the list of known hosts.
warning: You appear to have cloned an empty repository.
$ git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
mike@win10-001 MINGW64 ~/cookbook/cookbook (master)
$ echo "Hello Gitlab" >> README.md
mike@win10-001 MINGW64 ~/cookbook/cookbook (master)
$ git add README.md
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory.
mike@win10-001 MINGW64 ~/cookbook/cookbook (master)
$ git commit -m "Added readme file"
[master (root-commit) 53ec2ca] Added readme file
1 file changed, 1 insertion(+)
create mode 100644 README.md
mike@win10-001 MINGW64 ~/cookbook/cookbook (master)
$ git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 225 bytes | 112.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To gitlab.aishangwei.net:root/cookbook.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.