Skip to main content

Git: Configurations Settings

·329 words·2 mins· loading · loading ·
Git
UmmIt
Author
UmmIt
Loves to write about technology, and cybersecurity related topics :)
Table of Contents

Introduction
#

When working with Git, managing configurations is crucial for a seamless development experience. This guide explores setting up local and global configurations and provides a list of configurations for your reference.

Global Configuration
#

Global configurations apply to all repositories on your machine. They are useful for providing default identities for repositories without a local configuration. Set up global configurations with the following commands:

git config --global user.name "Username"
git config --global user.email "[email protected]"

Replace Username and [email protected] with the desired global username and email address.

Local Configuration
#

Local configurations are specific to a particular Git repository. To set up a local configuration for a repository, navigate to the repository’s directory and run the following commands:

git config --local user.name "Username"
git config --local user.email "[email protected]"

Replace Username and [email protected] with the desired local username and email address for the repository.

Verify Configurations
#

To confirm your configurations, you can use the following commands:

git config --local --get user.name
git config --local --get user.email

Use --global instead of --local to check the global configurations:

git config --global --get user.name
git config --global --get user.email

Full Config List
#

To view the complete list of configurations, use:

git config --list

This command displays all configurations, including user name, email, aliases, and other settings.

Conclusion
#

Now, when you work on a specific repository, Git will use the local configuration for that repository. For other repositories or situations where a local configuration is not available, Git will fall back to the global configuration.

This setup is handy when contributing to projects with different identities. Adjust the local configurations for each repository, and global configurations will serve as the default for repositories without a specific local configuration.

By following these steps and referring to the full config list, you can easily manage and switch between different identities when working on multiple Git repositories.

Reference
#

Related

How to Write Better Git Commit Messages
··1000 words·5 mins· loading · loading
Git
Effortless Integration: A Step-by-Step Guide to Creating and Merging the 'main' Branch into 'dev'
·685 words·4 mins· loading · loading
Git
Mastering Git: Wayback Commands
·387 words·2 mins· loading · loading
Git
Codeberg Pages: A Guide to Hosting Static Websites for free and Custom Domain Setup
··1134 words·6 mins· loading · loading
Git Codeberg Web
Converting SVG to PNG with Inkscape: A Quick Guide
·308 words·2 mins· loading · loading
Inkscape convert
Vim: A Quick Guide to Efficient Text Editing
·538 words·3 mins· loading · loading
Vim Linux Terminal