【Git】关于Gitea使用 Github Desktop 授权失败问题

关于Gitea使用 Github Desktop 授权失败问题

问题

搭建的 gitea 本地仓库,想使用github 的 desktop 可视化界面管理代码
git bash 拉取提交都没有问题
但是使用github desktop fetch 时候一直失败
在这里插入图片描述

解决办法

  1. 先检查现有 SSH 密钥:
    #Git Bash 输入命令
    ls -al ~/.ssh  #Lists the files in your .ssh directory, if they exist(列出.ssh文件夹里的文件)
    
    显示结果
    结果
    可以看到缺少公钥和私钥对,如果存在公钥,默认情况下的公钥的文件名是以下之一
    公钥的文件名
  2. 生成新 SSH 密钥并添加到 ssh-agent
    生成新 SSH 密钥
    ssh-keygen -t rsa -C "[email protected]"
    
    添加到 ssh-agent
    #启动SSH agent
    eval "$(ssh-agent -s)"
    #加私钥到SSH agent
    ssh-add ~/.ssh/[你的密钥文件名]
    
    为 GitHub 帐户添加新的 SSH 密钥
    为 GitHub 帐户添加新的 SSH 密钥
  3. 测试 SSH 连接
    ssh -T [email protected]
    

参考

  1. GitHub Desktop报错 Authentication failed. Some common reasons include
  2. 添加密钥到SSH密钥管理代理
  3. github 官方文档: 使用SSH连接

猜你喜欢

转载自blog.csdn.net/TaoDuanYi/article/details/140740981