E3SM icon indicating copy to clipboard operation
E3SM copied to clipboard

Git submodule update fails with latest FATES on Mac

Open rljacob opened this issue 3 months ago • 14 comments

When trying to update to the latest version of master using a clone on my Mac laptop, I'm seeing this error when updating the submodules:

jacob@Roberts-MacAirM2-2 E3SM % git submodule update --init --recursive
git-lfs filter-process: git-lfs: command not found
fatal: the remote end hung up unexpectedly
fatal: Unable to checkout '1afb393de4c4d3c74c2f95ca714b9f34996abbdf' in submodule path 'components/elm/src/external_models/fates'

If I immediately run it again, I get this error:

jacob@Roberts-MacAirM2-2 E3SM % git submodule update --init --recursive
error: The following untracked working tree files would be overwritten by checkout:
	.gitattributes
	.github/ISSUE_TEMPLATE/bug.yml
	.github/ISSUE_TEMPLATE/feature.yml
	.github/ISSUE_TEMPLATE/task.yml
	.github/PULL_REQUEST_TEMPLATE.md
	.github/images/logo_fates_large.png
	.github/images/logo_fates_medium.png
	.github/images/logo_fates_small.png
	.github/workflows/add-to-gh_projects.yml
	.gitignore
	.gitmodules
	.zenodo.json
	CMakeLists.txt
	CODE_OF_CONDUCT.md
	CONTRIBUTING.md
   (more files listed)
	main/FatesHistoryInterfaceMod.F90
	main/FatesHistoryVariableType.F90
	main/Fat
Aborting
fatal: Unable to checkout '1afb393de4c4d3c74c2f95ca714b9f34996abbdf' in submodule path 'components/elm/src/external_models/fates'

jacob@Roberts-MacAirM2-2 E3SM % git --version git version 2.50.1 (Apple Git-155)

rljacob avatar Oct 12 '25 01:10 rljacob

This seemed to start with merge of https://github.com/E3SM-Project/E3SM/pull/7665.

Doesn't happen on Chrysalis so possibly related to Mac filesystem case insensitivity.

rljacob avatar Oct 12 '25 02:10 rljacob

I ran into the same error on Chrysalis this morning.

git-lfs filter-process: git-lfs: command not found fatal: the remote end hung up unexpectedly fatal: Unable to checkout '5bb36cba29b95295aca5aedc13f348ef1e001b99' in submodule path 'components/elm/src/external_models/fates'

evasinha-pnnl avatar Dec 01 '25 20:12 evasinha-pnnl

And I also got the same error on Compy.

Unable to checkout '5bb36cba29b95295aca5aedc13f348ef1e001b99' in submodule path 'components/elm/src/external_models/fates'

evasinha-pnnl avatar Dec 01 '25 20:12 evasinha-pnnl

Can you try installing/initing git-lfs?

mahf708 avatar Dec 01 '25 20:12 mahf708

git lfs install

mahf708 avatar Dec 01 '25 20:12 mahf708

@mahf708

On both machines, I get the error:

git: 'lfs' is not a git command. See 'git --help'.

The most similar command is
	log

I think I need to download the git-lfs-X.X.X and then try to install it. Wouldn't it be optimum to have them installed on both machines by the admins instead of each user installing them on their own?

evasinha-pnnl avatar Dec 01 '25 20:12 evasinha-pnnl

I don't know how Rob managed to get it working on chrysalis and the fact we are not hitting this with testing, so it could be something in the user space causing this, idk...

You can also do some filtering/exclusion of the specific lfs settings. From a quick look, these appear to be the offending settings:

testing/test_data/*.nc filter=lfs diff=lfs merge=lfs -text

mahf708 avatar Dec 01 '25 21:12 mahf708

A quick workaround is to have git-lfs inside a conda env (conda install git-lfs) and do git lfs install which results in the following in global gitconftg

$ tail -n5 ~/.gitconfig 
[filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true

then proceed as usual with git clone ..., git submodule ...

mahf708 avatar Dec 01 '25 21:12 mahf708

Thanks @mahf708 for finding the cause of the error and suggesting a workaround.

evasinha-pnnl avatar Dec 01 '25 21:12 evasinha-pnnl

@evasinha, from a quick test, it seem simply deleting these lines from ~/.gitconfig is a valid workaround:

[filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true

mahf708 avatar Dec 01 '25 21:12 mahf708

Let us know if you manage to get past the error

mahf708 avatar Dec 01 '25 21:12 mahf708

Deleting the lines from .gitconfig is the best workaround.

But I'd like to know why FATES needs git-lfs? We thought about using it a while ago and decided not to because its not generally available on every platform with git. @rgknox @glemieux

rljacob avatar Dec 01 '25 21:12 rljacob

What I also don't understand is why this just happened now (for me on my laptop) considering it first happened way back in October.

rljacob avatar Dec 01 '25 21:12 rljacob

@mahf708 Modifying ~/.gitconfig to remove the following lines worked and all modules were successfully updated.

[filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true

evasinha-pnnl avatar Dec 01 '25 22:12 evasinha-pnnl