关于IDEA使用GIT克隆项目时出现:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,pas...

本文详细介绍了在使用IDEA和GIT通过SSH拉取项目时遇到的权限拒绝错误及其解决方法。首先调整IDEA的Git配置,然后通过终端命令ssh-add激活SSH密钥,最后设置启动代理实现持久化。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用IDEA和GIT利用SSH拉取项目时报以下错误:

git -c core.quotepath=false -c log.showSignature=false pull --progress --no-stat -v --progress origin master

Permission denied, please try again.
git@192.168.1.2: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

复制代码

先是百度搜了一下,发现全特么都是复制粘贴,无法解决问题。还是google好使。。

解决办法:

前置:已生成SSH KEY

第一步: 修改IDEA的配置,将 Version Control > Git > SSH executeable 调整为Native,如下图所示

第二步: 打开终端,在终端中输入:ssh-add -K,然后会让你输入生成SSH KEY的时候生成的密钥,输入一下就行了,如下图所示

好了,你就会发现能正常拉代码了。。

续: 发现电脑重启后又需要执行一次ssh-add -K,不知道为什么。。

续,,终极解决办法:

  1. 新建一个.plist文件,比如我叫gitlab.self.plist
  2. 把下面的内容填进去
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>ssh-add-a</string>
    <key>ProgramArguments</key>
    <array>
        <string>ssh-add</string>
        <string>-A</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
复制代码
  1. 放到~/Library/LaunchAgents
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值