Source Control / Git: Commit allegedly succeeded but files are ignored and git-objects are corrupt

40 次查看(过去 30 天)
Commit allegedly succeeded but files are ignored and git-objects are corrupt
==========================================================
Hello,
I regularly work with MATLAB's Source Control, for years, and all relevant GIT operations are available and successful.
However, I recently started another new project, and after a successful "Source Control" setup (adding and commiting by the "Source Control" interface, as I have always done before), the files immediately moved from normal green circles (expected commit sign) to dot sign (ignored), indicating that the project's files were not properly commited.
In the below, I describe various error reports that I get, which relate to this problem.
What could have happened that caused this commit failure, and how can this be fixed?
What could be different from the normal procedure that always worked for me before :)
THANK YOU!
--------------------------------------------------------
Related Errors Description:
** "Source Control --> Refresh Git Status" yields:
"Missing Unknown ....... "
** "Source Control --> Push" yields:
Unable to push to remote 'origin' at ....
src refspec 'refs/heads/master' does not match any existing object (-1x4)'
** The !git status command yields:
fatal: bad object HEAD
** The !git fetch command yields
fatal: git upload-pack: not our ref 0000000000000000000000000000000000000000
fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000
** The !git fsck --full command yields many such lines:
bad sha1 file: .git/objects/17/997a16efa1715247366cb39d410a47ca88d61c.tmp
and also:
error: refs/desktop.ini: invalid sha1 pointer 0000000000000000000000000000000000000000
error: refs/heads/desktop.ini: invalid sha1 pointer 0000000000000000000000000000000000000000
error: refs/heads/master: invalid sha1 pointer 55288f81110bf3b016a8c4020dc77609a3e3e292
error: refs/tags/desktop.ini: invalid sha1 pointer 0000000000000000000000000000000000000000
error: HEAD: invalid sha1 pointer 55288f81110bf3b016a8c4020dc77609a3e3e292
error: HEAD: invalid reflog entry 55288f81110bf3b016a8c4020dc77609a3e3e292
error: refs/heads/master: invalid reflog entry 55288f81110bf3b016a8c4020dc77609a3e3e292
error: bad ref for .git/logs/refs/heads/desktop.ini
error: bad ref for .git/logs/refs/desktop.ini
error: bad ref for .git/logs/desktop.ini
dangling tree 762bd76d7790b0422cb9a87fb43656023121b1bc
notice: No default references
** The !git ls-files command yields the list of all commited files.
Notes:
** The .git folders in both SandBox and Remote look ok.
** Both SandBox and Remote are on Google Drive. I have read that this should work.
** I tried several advices given for the situation (various git commands).
** .gitignore does NOT exclude any file yet
What could have happened, and how can this be fixed? What could be different from the normal procedure that always worked for me before :)
Thank you,
Regards.

回答(1 个)

Piyush Dubey
Piyush Dubey 2023-9-5
Hi Yoel,
I can understand that you are having trouble while performing “Source Control” setup and interface. The erroneous setup has caused corruption of the repository.
Please know that the errors shown on the console does not pinpoint to an exact cause of the issue. However, there seems to be an error in the Git repository while attempting to commit the files. The following explanations might explain the issue and guide you through steps that you can follow to troubleshoot and resolve the problem:
  • Corrupted repository: It's possible that the repository has become corrupted due to some unknown factors. In such cases, creating a new repository and recommitting your files may be the simplest solution.
  • Google Drive synchronization: Storing your repository on Google Drive can sometimes cause synchronization issues, especially if multiple devices are accessing the repository simultaneously. Try temporarily disabling Google Drive synchronization for the repository and see if the issues persist.
  • Git configuration: Double check your Git configuration to ensure that it is set up correctly. Verify that the remote repository URL is correct and that you have the necessary permissions to push to it.
  • Git object integrity: The errors related to bad object pointers and invalid reflog entries suggest possible corruption in the Git objects. You can try running git fsck full with the --lost-found option to attempt to recover any lost objects or repair the repository.
  • Local repository cleanup: If the issues persist, you can try cleaning up your local repository by removing any unnecessary or corrupted files. Make sure to back up your repository before attempting any cleanup operations.
Kindly refer to the following Git User Manual, under the subsection “Recovering from repository corruptionwhich consists of snippets of code that will be helpful in recovering the repository:
Hope this helps.

类别

Help CenterFile Exchange 中查找有关 Source Control Integration 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by