Is it possible to have different Git configuration for different projects?

前端 未结 12 742
萌比男神i
萌比男神i 2020-12-02 03:44

.gitconfig is usually stored in the user.home directory.

I use a different identity to work on projects for Company A and something else fo

12条回答
  •  时光取名叫无心
    2020-12-02 04:11

    Follow the Steps:

    1. Find .gitconfig from the system

      File Location For Windows : "C:\Users${USER_NAME}.gitconfig"

      File Location For Linux : "/usr/local/git/etc/gitconfig"

    2. Open .gitconfig file and add below lines as per your condition

       [includeIf "gitdir:D:\ORG-A-PROJECTS\"]
      
       [user]
      
           name = John Smith
      
           email = js@organizationx.com [includeIf "gitdir:~/organization_b/"]
      
       [user]
      
           name = John Doe
      
           email = jd@organizationy.com
      

提交回复
热议问题