无法从github获取提交 [英] Unable to fetch commit from github

查看:69
本文介绍了无法从github获取提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下命令无法检出此提交:

$ git clone git@github.com:DefinitelyTyped/DefinitelyTyped.git
$ cd DefinitelyTyped
$ git checkout e90424c424ef9087d0589234e9e9cd0140bab0d7
fatal: reference is not a tree: e90424c424ef9087d0589234e9e9cd0140bab0d7

尝试遵循此处提供的建议会导致以下结果:

Attempting to follow the advice given here results in the following:

$ git fetch origin e90424c424ef9087d0589234e9e9cd0140bab0d7
$ echo $?
1

此故障是特定于GitHub/GitHub上的大型存储库的吗?我的git版本是2.10.1.

Is this failure something specific to GitHub / large repos on GitHub? My git version is 2.10.1.

** 编辑 **

$ git fetch origin e90424c424ef9087d0589234e9e9cd0140bab0d7:refs/remotes/origin‌​/foo-commit
$ echo $?
1
$ git cat-file -p e90424c424ef9087d0589234e9e9cd0140bab0d7
fatal: Not a valid object name e90424c424ef9087d0589234e9e9cd0140bab0d7
$ git branch -a --contains e90424c424ef9087d0589234e9e9cd0140bab0d7 
error: no such commit e90424c424ef9087d0589234e9e9cd0140bab0d7
$ git reset e90424c424ef9087d0589234e9e9cd0140bab0d7
fatal: Could not parse object 'e90424c424ef9087d0589234e9e9cd0140bab0d7'.

推荐答案

如果重新配置存储库的基础,则可能会发生您所看到的行为.您可以通过将提交推送到远程存储库,然后用git commit --amend更新它,然后(强制)推送更新的存储库,来复制自己的内容.

The behavior you are seeing can happen if a repository is rebased. You can replicate this yourself by pushing a commit to a remote repository, then updating it with git commit --amend and (force) pushing the updated repository.

在某些垃圾回收运行之前,旧的提交ID将继续存在于远程存储库中,但是由于它无法从任何现有引用中获取,因此不会包含在git clone操作中.

The old commit id will continue to exist in the remote repository until some sort of garbage collection runs, but because it is unreachable from any existing reference it will not be included in a git clone operation.

这篇关于无法从github获取提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆