0

I am writing a bash script that needs to perform some git actions. I'm working on windows using MinGW.

running bash test.sh

with test.sh having the content:

echo "git config --global user.name -> $(git config --global user.name)"

This prints:

git config --global user.name ->

Whereas going on powershell and typing git config --global user.name prints my_actual_user_name.

I'd like in this case to user my user settings on git, which would include having access to my ssh keys, which it is not doing. How can I achieve this?

0

1 Answer 1

1

Try to use, both in your script and PowerShell:

git config --show-scope --show-origin user.name

You will see exactly which file is used to query that setting.
If they differ, that would explain your difference in output.


The OP Mefitico confirms in the comments HOME was not set.

Setting a user environment variable HOME to %USERPROFILE% is enough for a git bash session to access the same global .gitconfig setting file as a Git PowerShell session.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.