Skip to content

Instantly share code, notes, and snippets.

@brianjbayer
Created November 19, 2023 21:27
Show Gist options
  • Save brianjbayer/4b7e0d0d9d8148c7488047a4ec6f3904 to your computer and use it in GitHub Desktop.
Save brianjbayer/4b7e0d0d9d8148c7488047a4ec6f3904 to your computer and use it in GitHub Desktop.
How to configure your git globals on Mac

Configure Your Git Globals

Once you have at least a basic user profile with Homebrew, you can configure your git.

⚙️ You can use an automated script to configure your basic git global configuration.

I use a GitHub repository mac-setup for my basic Mac setup scripts including one to configure my git globals.

If you'd like, you can use my repository to configure your git globals.

:octocat: Just follow the PREREQUISITES and then Configure Your Git Globals of my GitHub repository


Configure Your Git Globals Manually

If you want to configure your git globals manually, you can follow these instructions.

Here you are globally configuring...

  • Username
  • Email
  • .gitignore

Configure Git user.name

To configure the username globally...

git config --global user.name <github-username>

Configure Git user.email

To configure the email globally...

git config --global user.email <github-emailaddress>

Create and Configure Global .gitignore

You will first need to CREATE a ~/.gitignore file that will be your global .gitignore file.

Here is a sample .gitignore file that you may find useful...

# Global gitignore

# Mac
.DS_Store

# IDEs
.idea/
.vscode

To configure the .gitignore file globally...

git config --global core.excludesfile ~/.gitignore

Other Configuration

To configure --ff-only as the default for git pull

git config --global pull.ff only

Verify Git Configuration

To verify the configuration...

git config --list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment