操作步骤:
1.在liunx客户端生成共钥和密钥
命令:ssh-keygen
[root@bx_1_50 ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y //已经存在公钥和密钥,是否覆盖
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:
b2:40:68:bd:28:31:9d:f6:37:8e:c6:ef:23:43:f1:0a root@bx_1_50
2.拷贝公钥到git服务器的用户的SSH Keys 中
命令:vim /root/.ssh/id_rsa.pub 拷贝出来
3.clone git 服务器上的项目
/opt/apps/git/bin/git clone [email protected]:xxx/xxx.git
********************************************************************************************
git 用yum安装的,没有配置绝对路径,写git命令的时候要带上路径
*********************************************************************************************