【问题标题】:Trying to clone a repository in git, getting a error尝试在 git 中克隆存储库,出现错误
【发布时间】:2011-07-05 20:37:26
【问题描述】:

我有两个盒子,一个是我的本地机器,另一个是我的开发服务器。现在我正在使用 Git 测试this method of deploying apps

我设置了我的本地存储库,添加了文件然后提交。我在 Windows 7 上,我的服务器是 Windows Server 2008。

服务器映射为 W:\ 驱动器,我的“裸”存储库和目标“模拟”生产文件夹作为子文件夹。 - 我可以很好地访问每个,没有连接问题。

这是我设置所有内容的方法:

  1. 本地目录 git remote add origin w:\gitCentral

  2. 本地目录 git push origin master

  3. 键入 C:,然后键入 CD testDeployment

  4. 现在我在我的测试文件夹中。

    A.我做 git clone w:/gitCentral

Cloning into gitCentral... done.
error: refs/remotes/origin/master does
not point to a valid object! error:
Trying to write ref refs/heads/master
with nonexistant object 559e2165845
06e14ebef1121059e9461a86dd4f8 fatal:
Cannot update the ref 'HEAD'.

【问题讨论】:

  • 我没有给你答案,但我建议尽可能多地添加标签,因为更多人会看到你的问题。尝试使用 git、error、repository、clone 和 deploy 等标签。更多标签将获得更多浏览量,获得实际答案的机会更高!祝你好运:)
  • @Joshua:请鼓励人们添加所有相关标签。 “最大可能”的措辞可能导致标签滥用

标签: git windows-7 corruption git-clone


【解决方案1】:

尝试执行以下操作(从您的本地文件夹开始,考虑到它是一个 git 存储库并且在当前 HEAD 中有提交):

git remote add origin w:/gitCentral
git fetch origin
git push origin master
cd C:/testDeployment
git clone w:/gitCentral

【讨论】:

    【解决方案2】:

    我认为,发生这种情况的原因有两个:

    Git 想要正斜杠,而不是反斜杠。 Git 不喜欢空格 - 使用引号。

    因此,如果您的遥控器是“w:\Repositories\My App”,Git 会希望将其视为“'w:/Repositories/My App'”。

    这是我的预感。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-08
      • 2014-06-06
      • 2019-02-01
      • 1970-01-01
      • 2021-07-09
      相关资源
      最近更新 更多