Mac Sourcetree鉴权失败、无法提交

Sourcetree出现鉴权失败,无法提交或无法克隆远程库,多半是更改了账号,需要重新设置ssh配置

1.先终端cdssh文件
cd ~/.ssh
2.在删除ssh文件夹里所以文件
3.再次重新设置邮箱
ssh-keygen -t rsa -C "[email protected]"

然后一直回车

Enter file in which to save the key (/Users/jackMac/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/jackMac/.ssh/id_rsa.
Your public key has been saved in /Users/jackMac/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:s9ObNgKycNZkCLdbMOtkdDxWl4DQEws5jBmu0TyOa0A [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|  .=o=.+o...     |
| ++ O.O. ..      |
|.E=+ X.o         |
|.= .* +          |
|+ .+ *  S        |
|... * o  +       |
|.. + o .o .      |
|.   .   ..oo     |
|         oo.     |
+----[SHA256]-----+
4.输入命令copy公钥,在gitlabe上配置好ssh
cat id_rsa.pub
5.最后一步就是顺便克隆一个项目创建known_hosts文件
git clone [email protected]:xxx/xxxx.git 
ssh

最后在Sourcetree提交代码或克隆就正常了。
如果还出现提示异常你在吧Sourcetree的缓存密码删除重新提交看看

Sourcetree

你可能感兴趣的:(Mac Sourcetree鉴权失败、无法提交)