When submitting the file to the warehouse, the following error is thrown:
Report an error
Roc@DESKTOP-AF552U2 MINGW64 /e/note/Git (master)
$ git add git_GitHub.md
error: bad signature
fatal: index file corrupt
Cause Analysis
Because index file generally refers to the file .git/index in git. This file saves the information in the temporary storage area (index information). You can use git ls-files –stage to view the contents of the staging area. This file is very important! But now it reports index file corrupt, indicating that this file has been damaged. Fortunately, we have a way to regenerate this file: git read-tree or directly git reset.
Solution
- Enter the project directory: cd /path/to/dir
- Delete or rename the .git/index file: rm -f .git/index or mv .git/index{,.bak}
- Rebuild .git/index: git read-tree or directly git reset
Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ mv .git/index .git/index.bak
Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git reset
Unstaged changes after reset:
M Git/git_use.md
M Git/git_para.md
Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: "Git/git\347\232\204\345\210\235\346\254\241\344\275\277\347\224\250.md"
modified: "Git/git\347\232\204\351\200\211\351\241\271\345\217\202\346\225\260.md"
Untracked files:
(use "git add <file>..." to include in what will be committed)
Git/git failed to push some refs to github.md
"Git/git \346\212\245\351\224\231 index file corrupt.md"
"Git/git\350\277\236\346\216\245GitHub\344\273\245\345\217\212\346\216\250\351\200\201\350\207\263\344\273\223\345\272\223.md"
no changes added to commit (use "git add" and/or "git commit -a")
Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
Done!
Read More:
- [Solved] Git push error: failed to push some refs to ‘[email protected]:daisy_yangyang/fed-e-task-04-01.git‘
- An error occurred during the signature verification in the ROS function pack warehouse
- [Solved] Cannot find command ‘git‘ – do you have ‘git‘ installed and in your PATH?
- [Solved] Invalid signature error for ROS repository while trying to do sudo apt-get update
- [Solved] fatal: not a git repository (or any of the parent directories): .git
- AFTER THE GIT SOURCE CODE IS INSTALLED, AN ERROR IS REPORTED /USR/BIN/GIT: NO SUCH FILE OR DIRECTORY
- [Solved] linux kernel load driver Error: module verification failed: signature and/or required key missing – tainting kernel
- Gamit Run Error: grep SP file :bad year 2021 [How to Solve]
- [Solved] FATAL CONFIG FILE ERROR: Bad directive or wrong number of arguments
- Git initializes the local existing project
- [Solved] Ubuntu tab Error: _complete:96: bad math expression: operand expected at end of string
- Git-2.16.1.2-64-bit Error: cannot spawn git: Function not implemented
- [Git] Solve git branch -M main error: refname refs/heads/master not found
- Git Error Resolution: errno:10054 Time out
- Git error when switching branches: Your local changes to the following files would be overwritten by checkout
- Error: error from slirp4netns while setting up port redirection: map[desc:bad request: add_hostfwd:
- [Solved] ERROR: Command errored out with exit status 128: git clone -q
- Git error: unpack failed: error Missing tree [How to Solve]
- [Solved] git error – remote: http basic: access denied
- [Solved] SSH Startup Error: unable to load host key /etc/ssh/ssh_host_ed25519_key bad permissions