Git checkout release branch faild

I tried to checkout origin/release branch from aws/amazon-freertos.git but I’m getting those submodule errors

"C:\Program Files\Git\bin\git.exe" checkout -B "release" "origin/release"
error: Entry 'libraries/coreHTTP/.github/CONTRIBUTING.md' not uptodate. Cannot merge.
error: Submodule 'libraries/coreHTTP' could not be updated.
error: Entry 'libraries/ota_for_aws/.github/workflows/ci.yml' not uptodate. Cannot merge.
error: Submodule 'libraries/ota_for_aws' could not be updated.
fatal: not a git repository: tools/litani/../../.git/modules/tools/litani

Any help on how I can resolved this?
Thanks

Hi @EyalG,
So I am unable to reproduce this issue. I am using git version 2.31.1.windows.1 so you could consider updating git if its a lower version. If you are running on Windows, also be sure to run git config --global core.symlinks true as the amazon-freertos repository uses symlinks. Commands run:

git clone https://github.com/aws/amazon-freertos.git --recurse-submodules
cd amazon-freertos
git checkout -B release origin/release
git submodule update --init --recursive

Note that you need to initialize and update the submodules after checking out a new branch - if you do not do this, then the submodules will be left at their main branch pointer.

It’s possible something faulty is happening with submodules when switching between branches so I recommend just cloning without the --recurse-submodules option and instead checkout release then checkout the submodules like such.

git clone https://github.com/aws/amazon-freertos.git
cd amazon-freertos
git checkout -B release origin/release
git submodule update --init --recursive

Alternatively, you could just download the tarball from here Release Version 202203.00 · aws/amazon-freertos · GitHub. Let me know if this helps.

Thank you Jason for your quick and detailed answer.
My GIT is 2.36.1.windows.1
and I already run the git config --global core.symlinks true
I retired the first option and got the same errors again (see attached log)
The second option worked fine so I’ll stick to it.
Thanks,
Eyal
amazon_freertos_release_git clone_log.zip (14.1 KB)

No problem. Glad I could help!