linux – 从文件树中删除git-annex存储库

我昨天尝试安装git-annex来备份我的文件.我跑了git附件添加.在我的存储库树的根目录然后是git提交.到目前为止一切都很好.

我不知道git-annex正在做的是将我的整个文件树变成一大堆符号链接.我整个树中的每个文件现在都符号链接到.git / annex / objects中!这搞乱了我的应用程序,这取决于文件不是符号链接.

我的问题是,如何摆脱git-annex并将我的文件系统恢复到原始状态?对于一个正常的git repo,我可以做rm -r .git,但我担心这不会在git-annex中完成.提前致谢.

解决方法

好吧,所以我偶然发现了一些 docs for git-annex,他们给出了两个命令来实现我想做的事情:

unannex [path …]

Use this to undo an accidental git annex add command. You can use git annex unannex to move content out of the annex at any point,even if you’ve already committed it.
This is not the command you should use if you intentionally annexed a file and don’t want its contents any more. In that case you should use git annex drop instead,and you can also git rm the file.

uninit

Use this to stop using git annex. It will unannex every file in the repository,and remove all of git-annex’s other data,leaving you with a git repository plus the prevIoUsly annexed files.

我开始运行git annex uninit,但我的上帝很慢. “unannex”只花了大约5分钟就完成了一个文件.我的文件系统树大约有200,000个文件,所以这是不可接受的.

我最终做的事实上非常简单并且运作良好.我使用cp -rL标志自动复制文件树的内容并反转复制副本中的所有符号链接.而且速度非常快:整个文件树大约需要30秒.唯一的问题是文件权限没有从原始状态保留,所以我需要运行一些chmod和chcon命令来修复权限.

第二种方法我有用,因为我的模式中没有其他符号链接.如果您的架构中的符号链接超出了git-annex创建的符号链接,那么我的小快捷方式可能不是您的正确选择,您应该考虑坚持使用git annex uninit.

相关文章

在Linux系统中,设置ARP防火墙可以通过多种方法实现,包括使...
在Linux环境下,使用Jack2进行编译时,可以采取以下策略来提...
`getid`命令在Linux系统中用于获取当前进程的有效用户ID(EU...
在Linux环境下,codesign工具用于对代码进行签名,以确保其完...
Linux中的`tr`命令,其英文全称是“transform”,即转换的意...
Linux中的ARP防火墙是一种用于防止ARP欺骗攻击的安全措施,它...