You try to commit and Git slaps you with a fatal error asking who you are. That is Git playing hard to get about author identity. Every commit needs a name and an email so version control can track who broke what and who to blame later.
First, see what the repo already knows about you. If nothing prints you get the lovely anonymous contributor experience.
git config user.name
git config user.email
If you are on a personal laptop and want to stop fixing this every five minutes use global settings. These become the defaults for all repositories on that machine.
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
This is the usual blessing for personal work. Use an email that matches your hosting account to get avatars and less mystery in contributor lists.
If you juggle work and personal accounts set identity inside the repository. Local repo config overrides global config without drama.
cd path/to/repo
git config user.name "Work Name"
git config user.email "work@example.com"
If you already committed with the wrong identity you can fix it. This rewrites history so be polite and check with your team before pushing.
git commit --amend --reset-author
# then, if you need to update the remote
git push --force-with-lease
Use care when rewriting public history unless your team enjoys surprise reverts.
Continuous integration systems do not have feelings and will not infer your name. Configure the environment so automated commits include an author identity.
export GIT_AUTHOR_NAME="CI Builder"
export GIT_AUTHOR_EMAIL="ci@example.com"
# or
git config --global user.name "CI Builder"
git config --global user.email "ci@example.com"
That is it. Give Git a name and an email and it will stop yelling. You will get cleaner version control history and fewer mysterious contributors to blame in the future.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.