Update, I wanted to try to see if maybe I could find a solution that wasn’t a drastic one just to see what would happen.
So in the agent dockefle I set:
git config --global --add safe.directory '*'
This fixed the issue for a freestyle project but not for the pipeline.
Both of the jobs are cloning the same repo and has the same configuration for the git checkout except for pipeline vs freestyle.
The error message for the pipeline has not changed so I am fully at a loss now.