CMake Error: grabRef.cmake no file head-ref

Hi,

I have some problem with a platformIO project, since I installed Git. I get the following error:

CMake Error at C:/Users/Desktop/ESP32_Test/.pio/build/esp32dev/bootloader/CMakeFiles/git-data/grabRef.cmake:48 (file): file failed to open for reading (No such file or directory):

C:/Users/Desktop/ESP32_Test/.pio/build/esp32dev/bootloader/CMakeFiles/git-data/head-ref

The file head-ref is automatically generated in the .pio folder, but I really don’t see what the problem is here. Any ideas?

By the way, the project is commited to git, but when I build with platformIO before I get the error, it says: – Project is not inside a git repository, or git repository has no commits; will not use ‘git describe’ to determine PROJECT_VER.

1 Like

Go to CLI and open project path

enter git status

if it showed the path to grabRef.cmake , try

git update-ref -d /.pio/build/esp32dev/bootloader/CMakeFiles/git-data/grabRef.cmake

otherwise,

git add /.pio/build/esp32dev/bootloader/CMakeFiles/git-data/grabRef.cmake

and then update it.

This will resolve the issue.