gitlab免密登录

[root@zxw6 zxw]# 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:
16:9b:ce:8e:cf:7d:0c:6a:57:4e:cf:8b:6f:fe:b4:c6 root@zxw6
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . |
| + |
| S |
| + . o |
| o. * o. .|
| +o.. +.+E.|
| .o+....+=+.|

[root@zxw6 ~]# ls .ssh
id_rsa id_rsa.pub
[root@zxw6 ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuWrq3PuUFuytyZahJ5Dc6eROovRMGl3PcVAwYoZ1i7GmzQlWPeClwmhMmo8dpkTG5wIKWo54j7Vr86ewnZ8tv50u9EMARlG00gaHNXKM38xudDJRYyCa6Bsi1O3C9hkiyl5ADqtPQE+l9f55C0FxINNL4mE4mJqVYzQZ+6V9F1gkDkx4S9azImfKySST6AnI61+FqgJRy6gEQ8Pcp/V8mEMOKQ8r37R7LIKCD+YOEeeLRIv3GlUKiYYqMDfOY6PVLIzDU2nyd+IkBAF2ThAiyTZZ378P0O87wwuMO7RqjwRshpnjegpU7dF+Wp37vFGWUQt0PbI0ndxD1pnjbD2eN

 

 

 

 

 

 

git clone git@192.168.126.6:root/1903.git
cd 1903
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
[root@zxw6 ~]# mkdir /zhao
[root@zxw6 ~]# cd /zhao
[root@zxw6 zhao]# git clone git@192.168.126.6:root/zxw.git
Cloning into 'zxw'...
The authenticity of host '192.168.126.6 (192.168.126.6)' can't be established.
ECDSA key fingerprint is 9c:65:d3:d9:49:7a:1b:c1:90:7e:f0:1f:df:c4:fd:8b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.126.6' (ECDSA) to the list of known hosts.
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
[root@zxw6 zhao]# ls
zxw
[root@zxw6 zhao]# cd zxw
[root@zxw6 zxw]# ls
z.txt
[root@zxw6 zxw]# touch {x,w}.txt
[root@zxw6 zxw]# ls
w.txt x.txt z.txt
[root@zxw6 zxw]# git add .
[root@zxw6 zxw]# git commit -m "v2"
[master b87a501] v2
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 w.txt
create mode 100644 x.txt
[root@zxw6 zxw]# git log
commit b87a501879a6467f250dadc5b99f249f1facd2ed
Author: Your Name <you@example.com>
Date: Tue Jul 16 03:55:26 2019 -0400

v2

commit f548d30f8aec7e454cdce8979a137a86226a3228
Author: Your Name <you@example.com>
Date: Tue Jul 16 03:03:46 2019 -0400

v1
[root@zxw6 zxw]# git push -u origin master
Counting objects: 3, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 229 bytes | 0 bytes/s, done.
Total 2 (delta 0), reused 0 (delta 0)
To git@192.168.126.6:root/zxw.git
f548d30..b87a501 master -> master
Branch master set up to track remote branch master from origin.

 

原文地址:https://www.cnblogs.com/itzhao/p/11306947.html