5

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

感谢您的回复。

- /编辑 -

我是 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花费这么多时间来找出应该简单的东西真是令人沮丧。:(

4

3 回答 3

2

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

  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 your-repo-name
  7. git remote add twbs https://github.com/twbs/bootstrap.git

现在你可以推送到你自己版本的 repo,git push origin master如果你想从原始 repo 中提取更改,你可以简单地做git pull twbs master.

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

于 2014-10-03T12:25:48.310 回答
0

所以你可以尝试的一件事是:

  1. 转到 github.com/THE_REPO_YOU_MADE
  2. 复制仓库顶部的 SSH url
  3. 删除任何旧的原点遥控器

    git remote
    git remote rm origin
    
  4. 创建一个名为“origin”(或您想要的任何名称)的 github 远程

    git remote add origin git@github.com:USER_NAME/REPO_NAME.git
    
  5. 将文件推送到刚刚添加的远程

    git push remote origin master
    

这些步骤假设您已经完成:

git init # creates a local repo
git add . # adds all files in the current directory
git commit -m "init commit" #commits your init

我知道这些是非常基本的步骤,可能无法回答您收到的错误,但这些步骤

另一件要尝试的事情是检查您是否在回购中拥有回购。这是我的学生有时会遇到的问题。绑定推送和权限时会导致一些错误

于 2013-03-27T20:46:40.967 回答
0

注意:至少对于 git 2.0.1(2014 年 6 月 25 日),错误消息可能更具体。

请参阅Jeff King ( )提交 77583e7peff

index-pack: 区分缺失对象和类型错误

当我们获取一个不包含我们期望接收的对象的包时,我们会收到如下错误:

$ git init --bare tmp.git && cd tmp.git
$ git fetch ../parent.git
[...]
error: Could not read 964953ec7bcc0245cb1d0db4095455edd21a2f2e
fatal: Failed to traverse parents of commit b8247b40caf6704fe52736cdece6d6aae87471aa
error: ../parent.git did not send all necessary objects

这来自check_everything_connected rev-list. 如果我们尝试克隆相同的 repo(而不是 a fetch),我们最终会使用index-pack's--check-self-contained-and-connected选项,它会产生如下输出:

$ git clone --no-local --bare parent.git tmp.git
[...]
fatal: object of unexpected type
fatal: index-pack failed

不仅缺少 sha1,而且是误导性消息。
没有类型问题,而是缺少对象问题;我们没有注意到差异,因为我们只是比较OBJ_BAD != OBJ_BLOB
让我们为这种情况提供不同的信息:

$ git clone --no-local --bare parent.git tmp.git
fatal: did not receive expected object 6b00a8c61ed379d5f925a72c1987c9c52129d364
fatal: index-pack failed

当我们这样做的时候,让我们也改进一个真正的类型不匹配错误看起来像

fatal: object 6b00a8c61ed379d5f925a72c1987c9c52129d364: expected type blob, got tree
于 2014-07-27T08:49:54.503 回答