git|git loose object问题处理
问题现象:
eldon@ubuntu:~/github/ColusLifeDemo$ git show
error: object file .git/objects/48/fafe9a709ab087741eb9a9824f457b89a4b27d is empty
error: object file .git/objects/48/fafe9a709ab087741eb9a9824f457b89a4b27d is empty
fatal: loose object 48fafe9a709ab087741eb9a9824f457b89a4b27d (stored in .git/objects/48/fafe9a709ab087741eb9a9824f457b89a4b27d) is corrupt
【git|git loose object问题处理】前天本人虚拟机强制关机了,怀疑跟这个有关。
删除冲突的文件:
eldon@ubuntu:~/github/ColusLifeDemo$ rm .-rf .git/
初始化本地仓库:
eldon@ubuntu:~/github/ColusLifeDemo$ git init
Initialized empty Git repository in /home/eldon/github/ColusLifeDemo/.git/
添加远端仓库:
eldon@ubuntu:~/github/ColusLifeDemo$ git remote add origin https://EldonZhao:xyz198920@github.com/ColusLife/ColusLifeDemo.git
同步代码:
eldon@ubuntu:~/github/ColusLifeDemo$ git fetch
remote: Counting objects: 197, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 197 (delta 0), reused 0 (delta 0), pack-reused 186
Receiving objects: 100% (197/197), 50.69 KiB | 24.00 KiB/s, done.
Resolving deltas: 100% (80/80), done.
From https://github.com/ColusLife/ColusLifeDemo
* [new branch]master-> origin/master
分支设置:
eldon@ubuntu:~/github/ColusLifeDemo$ git reset --hard origin/master
HEAD is now at 48fafe9 Change code to support admin to manage models
eldon@ubuntu:~/github/ColusLifeDemo$ git branch --set-upstream-to=origin/master master
Branch master set up to track remote branch master from origin.
eldon@ubuntu:~/github/ColusLifeDemo$ git branch -a
* master
remotes/origin/master
参考资料:
- http://stackoverflow.com/questions/21132646/git-loose-object-is-corrupt-what-data-have-i-lost
- http://www.zgxue.com/166/1664499.html
推荐阅读
- Windows在git-bash安装zsh
- 记一次gitlab-runner|记一次gitlab-runner 磁盘空间不足
- 翻翻git之---一个类解决圆角,虚线等自定义Button拒绝一堆无用的画布文件
- Objective-C|Objective-C 懒加载没有调用()
- Github上个人博客建立过程
- React|【React组件】github搜索案例之 父子组件通信 (附源码)
- Git|推荐几款好用的 Git 图形化客户端
- WIN配置git--配置后失败...can't|WIN配置git--配置后失败...can't be established
- 如何在spring boot 使用 gitlab的Api
- GIT(斯坦福大学提出应对复杂变换的不变性提升方法|GIT:斯坦福大学提出应对复杂变换的不变性提升方法 | ICLR 2022)