I want to use my [git branch] in app.config.ts when I build my app locally, so I use const BRANCH_NAME = execSync('git branch --show-current').toString(); to get [git branch].
But when I execute eas build --profile [pfoile] --local it will show error: “fatal: not a git repository (or any of the parent directories): .git”.
My question: How can I get branch name in locally build?
When you run eas build --local, eas copies your files to a temporary directory and then runs the build there. I suppose that when it tries to get the branch name it is running in the temporary directory instead of in your Git repository.
Maybe what you could do is add a script to package.json to get the branch name and then call eas build --local