git 每次都要先ssh-add ,才能使用, 不然就报错
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我也搜索过相关的问题, 说配置 .ssh/config
我的配置:
# 私有化的gitea
Host myali
Hostname xxx.xx.xx.xx
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_ali
#github
Host github.com
Hostname github.com
# PreferredAuthentications publickey
IdentityFile ~/.ssh/github_book
# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/rsa_gitee
配置的第一个 始终不生效,
每次提交代码都要在git bash里在先 执行 ssh-add ~/.ssh/id_rsa_ali
才能在此 git push
请问是哪里的问题?
你 git 地址用的啥?
这个要生效,地址里得是 myali 才成。如果地址里是
xxx.xx.xx.xx
,那你得写Host xxx.xx.xx.xx
。