【问题标题】:Linux Git remote to windows server 2016Linux Git远程到Windows Server 2016
【发布时间】:2018-10-25 12:40:05
【问题描述】:

在 Linux Ubuntu 上操作时遇到问题

git init
git remote add origin username@domain@server_IP:e:/myRepo
git fetch origin

输入密码后,我有这样的信息:

fatal: ''e:/myRepo'' 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.

我搜索并发现有“相同问题”的人,但我发布此问题的原因是我浏览了建议的解决方案,但没有一个对我有用。

这是我的情况:

-运行 OpenSSH 的 Windows Server 2016 上的裸存储库。 (e:\myRepo 拥有所有人的完全权利)

-能够在 Windows10 PC 上通过使用 powershell 运行额外的 git 命令来进行操作

git init
git remote add origin username@domain@server_IP:e:/myRepo
git config --local remote.origin.uploadpack "powershell git-upload-pack"
git config --local remote.origin.receivepack "powershell git-receive-pack"
git fetch origin

谢谢。

【问题讨论】:

  • 您是否拥有正确的访问权限?如果您没有克隆 repo 的权限,实际上任何人都无能为力
  • 是的@Liam 用于测试目的,我授予每个人完全控制权。
  • 该错误消息似乎暗示了其他情况。您的回购托管在什么平台上?您是如何授予“所有人的完全控制权”的?
  • 等等,这是windows还是Linux?
  • 裸repo在windows上,本地在linux上

标签: git git-remote git-config


【解决方案1】:

您的解决方法设置

git config --local remote.origin.uploadpack "powershell git-upload-pack"
git config --local remote.origin.receivepack "powershell git-receive-pack"

Git For Windows wiki

回答

您必须在所有 git 客户端(Windows*nix)上应用这些解决方法修复,只要 Git 服务器是 Windows

说明

错误消息路径中的那些双引号(例如''C:\some\path'')与Git服务器的默认shell(即命令提示符,因为它的操作系统是Windows)在将它们传递给git-upload-pack和@之前没有正确解析路径有关987654328@。

git clone(如所述链接中所示)、git pushgit remote -v 以及在您的情况下为 git fetch,您会收到类似的错误消息。

错误示例

$ git remote -v
origin git@windowshost:C:/some.git/
$ git push origin
fatal: ''C:/some.git/'' does not appear to be a git repository

【讨论】:

    猜你喜欢
    • 2017-04-30
    • 2017-07-26
    • 2017-04-21
    • 2019-12-10
    • 1970-01-01
    • 2018-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多