gitui 解决 git error:Bad credentials.

问题描述

cat .git/config 
"""
[remote "origin"]
	url = [email protected]:xxx.git
	fetch = +refs/heads/*:refs/remotes/origin/*
"""

ls -lh ~/.ssh/
"""
-rw------- 1 z z 2.6K  812 15:04 id_rsa
-rw-r--r-- 1 z z  564  812 15:04 id_rsa.pub
"""

git pull
#Already up to date.

直接使用git命令 操作 正常 返回 ,说明 ssh证书没问题

但是 gitui 跟ssh证书有关的操作报错: git error:Bad credentials. 原因是:

gitui通过ssh-agent获取的ssh证书,而ssh-agent根本没启动

解决办法:启动ssh-agent

#显示ssh-agent启动命令
ssh-agent -s
"""
SSH_AUTH_SOCK=/tmp/ssh-XXXXXXApbJHq/agent.20280; export SSH_AUTH_SOCK;
SSH_AGENT_PID=20281; export SSH_AGENT_PID;
echo Agent pid 20281;
"""

#启动ssh-agent
eval "$(ssh-agent -s)"
#Agent pid 20311

#查看ssh-agent正常启动?
ssh-add -l
#The agent has no identities.

#ssh私钥添加到ssh-agent
ssh-add ~/.ssh/id_rsa
Identity added: /home/z/.ssh/id_rsa (x@xxx)

#gitui 的ssh私钥有关操作正常了

你可能感兴趣的:(git,gitui)