主页

git pull的时候报错:git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

2025-10-31 02:24PM

我在git pull的时候报错了

root@localhost:/opt/app/000_README_FOR_all_repo# git pull
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

遇到 Permission denied (publickey) 错误,原因是因为GitHub无法通过SSH密钥认证你的身份

修改该项目 .git/config  文件的内容

[core]
  repositoryformatversion = 0
  filemode = false
  bare = false
  logallrefupdates = true
  ignorecase = true
[remote "origin"]
  url = git@github.com:top/cms.git # 修改这一行的内容
  url = https://github.com/top/cms.git # 修改为这个
  fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
  remote = origin
  merge = refs/heads/main 

这样就可以正常拉取代码了 

返回>>

登录

请登录后再发表评论。

评论列表:

目前还没有人发表评论