blog.kulman.sk/different-git-config-for-work-projects

Preview meta tags from the blog.kulman.sk website.

Linked Hostnames

6

Search Engine Appearance

Google

https://blog.kulman.sk/different-git-config-for-work-projects

Using different Git config for personal and work projects

I use the same machines to work on both personal and work projects. I usually have to use a different Git identity for the work projects than for my personal projects. Previously I had my personal Git identity set globally and then used local Git configs to override it in work projects. This worked just fine but it was too much work. There is a better solution. Git config allows you to use, or better to say include, another Git config for a specific directory and all its subdirectories. I have all my projects stored in ~/Projects and subdirectories like ~/Projects/open-source and work projects in ~/Projects/CompanyName. I created a ~/.companyName.gitconfig that overrides just the name, email and GPG signing key to match the work identity [user] name = Igor Kulman email = [email protected] signingkey = ABC I then included this config in my main ~/.gitconfig just for the ~/Projects/CompanyName directory [user] name = Igor Kulman email = [email protected] signingkey = DEF ... [includeIf "gitdir:~/Projects/CompanyName/"] path = ~/.companyName.gitconfig to achieve exactly what I needed. To verify and quickly check which Git identity is being used in a specific Git repository you can use this simple Git alias [alias] whoami = "! git var -l | grep '^GIT_.*_IDENT'"



Bing

Using different Git config for personal and work projects

https://blog.kulman.sk/different-git-config-for-work-projects

I use the same machines to work on both personal and work projects. I usually have to use a different Git identity for the work projects than for my personal projects. Previously I had my personal Git identity set globally and then used local Git configs to override it in work projects. This worked just fine but it was too much work. There is a better solution. Git config allows you to use, or better to say include, another Git config for a specific directory and all its subdirectories. I have all my projects stored in ~/Projects and subdirectories like ~/Projects/open-source and work projects in ~/Projects/CompanyName. I created a ~/.companyName.gitconfig that overrides just the name, email and GPG signing key to match the work identity [user] name = Igor Kulman email = [email protected] signingkey = ABC I then included this config in my main ~/.gitconfig just for the ~/Projects/CompanyName directory [user] name = Igor Kulman email = [email protected] signingkey = DEF ... [includeIf "gitdir:~/Projects/CompanyName/"] path = ~/.companyName.gitconfig to achieve exactly what I needed. To verify and quickly check which Git identity is being used in a specific Git repository you can use this simple Git alias [alias] whoami = "! git var -l | grep '^GIT_.*_IDENT'"



DuckDuckGo

https://blog.kulman.sk/different-git-config-for-work-projects

Using different Git config for personal and work projects

I use the same machines to work on both personal and work projects. I usually have to use a different Git identity for the work projects than for my personal projects. Previously I had my personal Git identity set globally and then used local Git configs to override it in work projects. This worked just fine but it was too much work. There is a better solution. Git config allows you to use, or better to say include, another Git config for a specific directory and all its subdirectories. I have all my projects stored in ~/Projects and subdirectories like ~/Projects/open-source and work projects in ~/Projects/CompanyName. I created a ~/.companyName.gitconfig that overrides just the name, email and GPG signing key to match the work identity [user] name = Igor Kulman email = [email protected] signingkey = ABC I then included this config in my main ~/.gitconfig just for the ~/Projects/CompanyName directory [user] name = Igor Kulman email = [email protected] signingkey = DEF ... [includeIf "gitdir:~/Projects/CompanyName/"] path = ~/.companyName.gitconfig to achieve exactly what I needed. To verify and quickly check which Git identity is being used in a specific Git repository you can use this simple Git alias [alias] whoami = "! git var -l | grep '^GIT_.*_IDENT'"

  • General Meta Tags

    11
    • title
      Using different Git config for personal and work projects - Igor Kulman
    • charset
      utf-8
    • X-UA-Compatible
      IE=edge
    • viewport
      width=device-width, initial-scale=1, shrink-to-fit=no
    • theme-color
  • Open Graph Meta Tags

    4
    • og:title
      Using different Git config for personal and work projects
    • og:description
      I use the same machines to work on both personal and work projects. I usually have to use a different Git identity for the work projects than for my personal projects. Previously I had my personal Git identity set globally and then used local Git configs to override it in work projects. This worked just fine but it was too much work. There is a better solution. Git config allows you to use, or better to say include, another Git config for a specific directory and all its subdirectories. I have all my projects stored in ~/Projects and subdirectories like ~/Projects/open-source and work projects in ~/Projects/CompanyName. I created a ~/.companyName.gitconfig that overrides just the name, email and GPG signing key to match the work identity [user] name = Igor Kulman email = [email protected] signingkey = ABC I then included this config in my main ~/.gitconfig just for the ~/Projects/CompanyName directory [user] name = Igor Kulman email = [email protected] signingkey = DEF ... [includeIf "gitdir:~/Projects/CompanyName/"] path = ~/.companyName.gitconfig to achieve exactly what I needed. To verify and quickly check which Git identity is being used in a specific Git repository you can use this simple Git alias [alias] whoami = "! git var -l | grep '^GIT_.*_IDENT'"
    • og:type
      article
    • og:url
      https://blog.kulman.sk/different-git-config-for-work-projects/
  • Twitter Meta Tags

    3
    • twitter:card
      summary
    • twitter:title
      Using different Git config for personal and work projects
    • twitter:description
      I use the same machines to work on both personal and work projects. I usually have to use a different Git identity for the work projects than for my personal projects. Previously I had my personal Git identity set globally and then used local Git configs to override it in work projects. This worked just fine but it was too much work. There is a better solution. Git config allows you to use, or better to say include, another Git config for a specific directory and all its subdirectories. I have all my projects stored in ~/Projects and subdirectories like ~/Projects/open-source and work projects in ~/Projects/CompanyName. I created a ~/.companyName.gitconfig that overrides just the name, email and GPG signing key to match the work identity [user] name = Igor Kulman email = [email protected] signingkey = ABC I then included this config in my main ~/.gitconfig just for the ~/Projects/CompanyName directory [user] name = Igor Kulman email = [email protected] signingkey = DEF ... [includeIf "gitdir:~/Projects/CompanyName/"] path = ~/.companyName.gitconfig to achieve exactly what I needed. To verify and quickly check which Git identity is being used in a specific Git repository you can use this simple Git alias [alias] whoami = "! git var -l | grep '^GIT_.*_IDENT'"
  • Item Prop Meta Tags

    6
    • name
      Using different Git config for personal and work projects
    • description
      I use the same machines to work on both personal and work projects. I usually have to use a different Git identity for the work projects than for my personal projects. Previously I had my personal Git identity set globally and then used local Git configs to override it in work projects. This worked just fine but it was too much work. There is a better solution. Git config allows you to use, or better to say include, another Git config for a specific directory and all its subdirectories. I have all my projects stored in ~/Projects and subdirectories like ~/Projects/open-source and work projects in ~/Projects/CompanyName. I created a ~/.companyName.gitconfig that overrides just the name, email and GPG signing key to match the work identity [user] name = Igor Kulman email = [email protected] signingkey = ABC I then included this config in my main ~/.gitconfig just for the ~/Projects/CompanyName directory [user] name = Igor Kulman email = [email protected] signingkey = DEF ... [includeIf "gitdir:~/Projects/CompanyName/"] path = ~/.companyName.gitconfig to achieve exactly what I needed. To verify and quickly check which Git identity is being used in a specific Git repository you can use this simple Git alias [alias] whoami = "! git var -l | grep '^GIT_.*_IDENT'"
    • datePublished
      2020-12-02T05:29:12+01:00
    • dateModified
      2020-12-02T05:29:12+01:00
    • wordCount
      206
  • Link Tags

    10
    • apple-touch-icon
      https://blog.kulman.sk/apple-touch-icon.png
    • canonical
      https://blog.kulman.sk/different-git-config-for-work-projects/
    • icon
      https://blog.kulman.sk/favicon.ico
    • preload
      https://blog.kulman.sk/theme.png
    • preload
      https://blog.kulman.sk/images/avatar.jpg

Links

20