I have a dotfiles repository for macOS that contains a file .gitconfig. I would like to keep usernameit emailseparate from this file so that these variables are never executed as part of my public dotfiles repository.
One approach that I saw is to specify a file with a name .extra, saving it in a directory ~/(referenced in it .bash_profile) and set the Git variables in this file so that they are external to my public repository, i.e. any public changes, which I do for .gitconfigwill not include usernameand email.
The problem is that none of the approaches to setting these values ββwork for me. After each attempt, I get the following message:
Your name and email address have been automatically configured for your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After that, you can fix the identifier used for this commit with:
git commit --amend --reset-author
My .extrafile has the following:
GIT_AUTHOR_NAME="First Last"
GIT_COMMITTER_NAME="First Last"
EMAIL=email@example.com
I tried various approaches using these variables and others, and also included and excluded quotes and even prefixing these strings with export. Lose a little!
source
share