MATLAB Projects causes error on git (missing HEAD)

26 次查看(过去 30 天)
I have tried many times to integrate my repository with MATLAB Projects. Initially, everything seems fine - I was able to add the *.prj file and everything in the resources/project folder and push them to GitHub. Then, after adding submodules in the repository, I was unable to do anything (fetch, pull, push, refresh etc). UPDATE: It doesn't have to do with submodules, the error could happen even before adding any submodules. It seems like my local repo is corrupted (?). I have tried this again and again (deleting the local repo and cloning from the remote) to no avail. I even try creating a dummy repo and initializing a project there, same results. This is the error that always appears:
Unable to fetch from the remote 'origin' at <the repo url>.
object not found - no match for id (<latest commit ID (HEAD)>) (-3x9)
Even right-clicking in the current directory gives an error:
Please help as I really want to use projects as they are quite convenient to deal with dependencies. Thank you!

采纳的回答

Khairul Adib Yusof
Khairul Adib Yusof 2022-3-28
编辑:Khairul Adib Yusof 2022-3-28
This has been resolved. The cause has nothing to do with MATLAB (although it is more likely to happen if MATLAB Project is used within the repo). It is caused by Google Drive or OneDrive desktop integration as described here:
The problem boils down to a race condition where Git creates and modifies files rapidly and the storage solution trying to keep up. In some scenarios this can lead to file IO not behaving as Git expects. A storage solution might also erroneously restore a file that was meant to be removed. While these sort of issues are most likely to occur when you're sharing the repository with other people we've seen issues with people who only use the storage for backup purposes.
Fix: Pause the background sync when you are working with MATLAB.
I hope this helps somebody in the future!

更多回答(0 个)

类别

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

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by