gpt4 book ai didi

git - 将本地 git 获取到新的 github 存储库时出错

转载 作者:太空狗 更新时间:2023-10-29 13:27:41 26 4
gpt4 key购买 nike

-- 编辑--我最终将所有文件复制到另一个文件夹并从那里推送。没有提交历史。 :(

感谢您的回复。

--/编辑--

我是 git 的新手。对于我的 html5 应用程序,我使用了 aptana 的 html5 样板,它为您安装了一个 git 存储库。好的。现在,在我的应用程序上工作了几周之后,我想将它推送到 github。我在那里创建了一个新的存储库。

现在,当我尝试从 shell 或 tortoisegit 推送到 github 时,我在所有文件上传后遇到错误:

$ git push -u origin master
...
remote: error: unable to find b4587434...<snip>...c701 (probably a checksum)
remote: fatal: objet of unexpected type
error: unpack failed: index-pack abnormal exit
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'https://github.com/<user>/<project>.git'

我一直在四处寻找解决方案,但还没有找到任何东西。我尝试了一些没有帮助的操作:

  • 我已将 origin 重命名为其他名称。
  • 我在 github 上创建了另一个存储库。
  • “git status”确认我没有什么可提交的。

请帮助,git 花费如此多的时间来弄清楚一些应该简单的东西,这真是令人沮丧。 :(

最佳答案

我试图镜像 Twbs bootstrap,但出现了这样的错误,我的问题是我使用 --depth=1 克隆了 repo。我在没有 --depth= 参数的情况下重新克隆了 repo,并且使用这些步骤一切正常:

  1. git clone --bare https://github.com/twbs/bootstrap.git
  2. cd bootstrap.git
  3. git push --mirror git@github.com:yourusername/your-repo-name.git
  4. cd ../&& rm -rf bootstrap.git
  5. git clone git@github.com:yourusername/your-repo-name.git
  6. cd 你的仓库名
  7. git remote add twbs https://github.com/twbs/bootstrap.git

现在您可以使用 git push origin master 推送到您自己的 repo 版本,如果您想从原始 repo 中 pull 更改,您可以简单地执行 git pull twbs master

更多信息@ https://help.github.com/articles/duplicating-a-repository/

关于git - 将本地 git 获取到新的 github 存储库时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15668645/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com