我可以从远程存储库获取所有git对象吗? [英] Can I fetch all git objects from a remote repository?

查看:168
本文介绍了我可以从远程存储库获取所有git对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从本地机器丢失了一些代码,并且我认为我有github存储库中的对象,问题是,它们是悬挂对象,我不知道如何获取它们,有没有办法获取它们?



下面是这一切发生的过程(包括我的愚蠢):

我有一个存储库包含一些庞大的SQL数据(回购大约300M),因为存储库大小正在制作 git clone 慢,我继续前进并删除了大文件

git之后filter-branch'git rm ...'我修复了依赖于已删除数据的测试,并编写了一些代码,我提交了更改和 git push --force origin



当我尝试使用这个新存储库重新绑定时,它只是感觉到它的表面。 git filter-branch'git rm ...'改变了第一次提交,所以一切都变成冲突。



因为我不能重新定义我决定尝试一些不同的东西,我从我的本地机器中删除了存储库,并从旧的存储库中将我的备份从>备份到github 。

这就是我失去了一些工作。



我认为这些对象仍然在github中,因为它们有关如何删除敏感数据的文章说:


本文将告诉您如何提交敏感数据无法从您的任何分支或标签提交GitHub存储库。然而,重要的是要注意,这些提交可能仍然可以在您的存储库的任何克隆或分支中访问,直接通过其在GitHub上的缓存视图中的SHA-1哈希通过引用它们的任何请求。您无法对存储库中的现有克隆或叉子进行任何操作,但您可以联系支持以永久移除所有存储库的缓存视图,并使用违规提交来拉取请求。



解决方案

此评论告诉你,由于无法识别的克隆或分支,你可能还有整个项目的其他副本。
$ b

如果是这样,你有幸运 - 验证它是否真的没有动过,然后把未触动的回购推到你的远程。



运气不错,我建议你按照以下步骤操作:


  1. 制作一个完整的深层副本(它必须包含)。您的repoistory文件夹的git 作为备份。 阅读关于 data recovery and this post 并尝试不同的策略来恢复您的数据。如果出现问题,请重新备份副本。
  2. code> git gc


    I lost some code from my local machine, and I think I have the objects in the github repository, the problem is, they are dangling objects and I don't know how to fetch them, is there a way to fetch them?

    Here is how it all happened (including my stupidity in it):

    I have a repository that contains some huge SQL data (the repo is around 300M), since the repository size was making git clone slow I went ahead and deleted the huge files.

    After git filter-branch 'git rm ...' I fixed my tests that depended on the deleted data, and wrote some code, I commited the changes and git push --force origin them into github.

    When I tried to rebase with this "new" repository, it just felt in its face. git filter-branch 'git rm ...' changed the very first commit, so everything became a conflict.

    Because I couldn't rebase I decided to try something different, I deleted the repository from my local machine, and git push --force my backup from the old repository into github.

    That is how I lost some work.

    I think that the objects are still in github because their article on how to remove sensible data says:

    This article tells you how to make commits with sensitive data unreachable from any branches or tags in your GitHub repository. However, it's important to note that those commits may still be accessible in any clones or forks of your repository, directly via their SHA-1 hashes in cached views on GitHub, and through any pull requests that reference them. You can't do anything about existing clones or forks of your repository, but you can contact support to permanently remove all of your repository's cached views and pull requests with the offending commits.

    解决方案

    The comment tells you just, that you may have other copies of the whole project, due to unrecognized clones or forks.

    If so, you had luck - verify it's really untouched then just push the untouched repo to your remote.

    In the case you don't had luck i suggest you to follow these steps:

    1. Make a complete deep copy (it must contain .git of your repoistory-folder as a backup.
    2. Read that chapter about data recovery and this post and try different strategies to recover your data. If something fails badly, make a copy from your backup again.

    And whatever you read anywhere avoid git gc.

    这篇关于我可以从远程存储库获取所有git对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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