You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

推送远程仓库出现fatal Error错误,GitHub可正常推送,缺失配置求助

Git局域网私有仓库推送报错修复方案

你执行的操作及报错原文:

e.gatoto@EMMANUEL MINGW64 ~/Desktop/myrepo.git (master) $ git push origin master
e.gatoto@192.168.180.27's password:
fatal: ''~/Desktop/myrepo.git'' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

错误根因

该报错和GitHub推送配置无关,仅针对你配置的局域网192.168.180.27私有远程仓库生效,核心问题是Git通过SSH连接远程主机后,无法找到你填写的仓库路径,或没有对应读写权限。

具体修复步骤

  • 第一步:确认当前远程仓库配置
    执行命令git remote -v,查看origin对应的远程地址是否为你预期的192.168.180.27仓库路径,若地址填写错误直接修改。
  • 第二步:修正远程仓库路径格式
    SSH场景下不推荐使用~相对路径,建议替换为远程主机上的绝对路径:
    1. 先手动SSH登录远程主机:ssh e.gatoto@192.168.180.27,输入密码确认可以正常登录
    2. 登录后执行命令cd ~/Desktop/myrepo.git && pwd,获取该仓库的绝对路径,示例输出为/home/e.gatoto/Desktop/myrepo.git
    3. 回到本地仓库执行命令修改远程地址:git remote set-url origin e.gatoto@192.168.180.27:/home/e.gatoto/Desktop/myrepo.git
  • 第三步:验证远程仓库合法性
    登录远程主机后查看仓库目录下是否存在HEAD、config、objects等Git核心文件,若不存在说明该目录不是合法Git仓库,需要重新在远程主机执行git init --bare myrepo.git初始化裸仓库。
  • 第四步:检查目录权限
    确认e.gatoto用户对远程仓库目录及其子文件有可读可写权限,可在远程主机执行sudo chown -R e.gatoto:e.gatoto /home/e.gatoto/Desktop/myrepo.git修正权限。

内容的提问来源于stack exchange,提问作者Mannu254

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.29 10:09:04