no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

新建文件:mkdir wakav
进入文件:cd wakav
初始化:git init
配置用户名和邮箱:

git config --global user.name "lining"  
git config --global user.email "[email protected]"

创建新的KEY:

ssh-keygen -t rsa -C "[email protected]"  
Creates a new ssh key using the provided email Generating public/private rsa key pair.  
#此处输入将要保存的路径,默认为当前路径  
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):  
输入回车后提示输入一个类似于密码的自定义的通行证号,如果直接回车则为空  
Enter passphrase (empty for no passphrase):a passphrase>  
#提示重新输入以便确认输入是否正确  
Enter same passphrase again:  

查看新的key:

vi ~/.ssh/id_rsa.pub

将内容添加到服务器上。

从远程服务器克隆项目代码到本地:

[root@localhost wakav]# git clone ssh://lining@IP:8849/wakav
正克隆到 'wakav'...
Unable to negotiate with 114.215.120.180: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

这里提示说key配置的不正确,网上搜了下(参考:https://wiki.archlinux.org/index.php/Secure_Shell),要配置git的config文件。

vi ~/.ssh/config

内容如下:

Host somehost.example.org(这是服务器地址)
    KexAlgorithms +diffie-hellman-group1-sha1

然后就可以克隆成功了!

Author:leedaning
本文地址:http://blog.csdn.net/leedaning/article/details/49887015

你可能感兴趣的:(版本控制)