Setting different config for different repositories
git, github
Solution
If you want to set up configurations that are specific for a particular repository, you have two options, to configure it from the command line, or edit the repo's config file in an editor.
Option 1: Configure via command line
Simply use the command line, `cd` into the root of your Git repo, and run `git config`, without the `--system` and the `--global` flags, which are for configuring your machine and user Git settings, respectively:
cd <your-repo>
git config <setting-name> <setting-value>
git config <setting-name>=<setting-value> # alternate syntax
Option 2: Edit config file directly
Your other option is to edit the repo config file directly. With a default Git clone, it's usually the `.git/config` file in your repo's root folder. Just open that file in an editor and starting adding your settings, or invoke an editor for it at the command line using `git config --edit`.
Resources
You can learn more about configuring Git at the official Linux Kernel Git documentation for `git config`. In particular, you may be interested in seeing an example Git config:
# Core variables
[core]
; Don't trust file modes
filemode = false
# Our diff algorithm
[diff]
external = /usr/local/bin/diff-wrapper
renames = true
[branch "devel"]
remote = origin
merge = refs/heads/devel
# Proxy settings
[core]
gitProxy="ssh" for "kernel.org"
gitProxy=default-proxy ; for the rest
[include]
path = /path/to/foo.inc ; include by absolute path
path = foo ; expand "foo" relative to the current file
path = ~/foo ; expand "foo" in your $HOME directory
Edit
Addressing the original poster's question about how to change `user.name` and `user.email` per repository, here is how to do it via the command line. Switch to each repository, and run the following:
git config user.name "<name>"
git config user.email "<email>"
Since you're not using the `--system` or the `--global` flags, the above commands will apply to whichever repo you have in your terminal working directory only.
Problem
I was wondering how am I going to change the contents of the command `git config --list`? I am going to pull/fork a repository from GitHub. I am going to configure such repositories on both of my Windows, Linux and Mac workstations.