github 解决 Agent admitted failure to sign using the key

公司迁移git 新库,重新迁移数据。

添加 ssh key 

1. 首先要在新git 库管理平台 添加新的ssh-key :

本机上执行 

ssh-keygen -t rsa -C "YourName@example.com" 

输出大致如下:

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xxx/.ssh/id_rsa):  <----缺省就可以,直接回车
Enter passphrase (empty for no passphrase):	<----密码可以不用设,太多密码谁记得住,直接回车
Your identification has been saved in /Users/xxx/.ssh/id_rsa. 
Your public key has been saved in /Users/xxx/.ssh/id_rsa.pub

2. 将 id_rsa.pub文件 内容复制到git上的ssh key 

3. 同时添加 到本机的ssh key 列表: ssh-add 

/Users/xxx/.ssh/id_rsa

迁移

1、带历史数据的迁移:

1、在新版的页面上建立新的project

2、修改本地repo的url: git remote set-url origin ${new_repo_url}  ;   git remote set-url --push origin ${new_repo_url}

3、git push -u origin --all  ;   git push -u origin --tags

 

2、不带历史数据的迁移:

1、在新版的页面上建立新的project

2、删除本地repo的.git目录

3、git init

4、git remote add origin ${new_repo_url}

5、git add .

6、git commit -m "Initial commit"

7、git push -u origin master

 

但是 在git push -u origin --all  时,出现 Agent admitted failure to sign using the key  错误,原因是 没有进行上述:3. 同时添加 到本机的ssh key 列表: ssh-add ,添加进即可

原文地址:https://www.cnblogs.com/xpxstar/p/9354526.html