Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 908 Bytes

config.md

File metadata and controls

46 lines (34 loc) · 908 Bytes

Git Config

Customizing configs for different repos

For most git users, different git configs for different repos are desired. Here comes a way to get it done once and for ever.

$ cd ~ && tree -La 2
.
├── .gitconfig
└── company
    └── .gitconfig

For example, for the user profile case:

  • .gitconfig: git config under user scope

    [user]
    name = YourUsername
    email = [email protected]
    
    # Keep these lines at the bottom of the file
    [includeIf "gitdir:~/company/"]
    path = ~/company/.gitconfig
    
  • company/.gitconfig: git config for specific repos under company directory

    [user]
    name = YourUsernameForCompany
    email = [email protected]
    

To check if it works:

$ cd ~/company/any_repo && git config user.name
YourUsernameForCompany

$ git config user.email
[email protected]