如何恢复 Git 存储库
我的 Git 存储库位于服务器上,我需要...
- 恢复存储库
- 删除日志/历史记录
- 删除所有文件
我该怎么做?谢谢。
My Git repository is on the server and I need to...
- restore the repository
- remove logs / history
- remove all files
How could I do it? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以为每个远程分支
git push origin :
。这将删除所有远程分支,最终旧的对象数据库可能会被清理。要在 bash 中执行此操作,请执行如下命令:
for i in $(git Branch -r | grep origin | sed 's#origin/##');执行 git push origin :$i;完成
。我没有尝试过,也不想尝试。这个存储库到底托管在哪里,您没有 ssh 访问权限,也无法通过其他方法删除它(github 等人应该有某种手动删除它们的方法)?
You might be able to
git push origin :<remote branch name>
for every single remote branch. This will delete all remote branches and eventually the old object db will probably be cleaned up.To do this in a bash one liner execute something like this:
for i in $(git branch -r | grep origin | sed 's#origin/##'); do git push origin :$i; done
. I haven't tried this, nor do I want to.Where exactly is this repo hosted that you don't have ssh access and can't delete it through some other method (github, et al should have some way of deleting them manually)?
您可以通过 ssh 进入服务器,转到目录,确保位于您期望的位置,然后使用“rm -rf $path”将其删除。
You could ssh into the server, go to the directory, make sure you are where you expect, and delete it with "rm -rf $path".