Can I specify multiple users for myself in .gitconfig?

后端 未结 20 2373
无人及你
无人及你 2020-11-22 06:33

In my ~/.gitconfig, I list my personal email address under [user], since that\'s what I want to use for Github repos.

But, I\'ve recently s

20条回答
  •  悲哀的现实
    2020-11-22 06:54

    GIT_AUTHOR_EMAIL + local .bashrc

    .bashrc_local: don't track this file, put it only on your work computer:

    export GIT_AUTHOR_EMAIL='me@work.com'
    export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
    

    .bashrc: track this file, make it the same on both work and home computers:

    F="$HOME/.bashrc_local"
    if [ -r "$F" ]; then
        . "$F"
    fi
    

    I'm using https://github.com/technicalpickles/homesick to sync my dotfiles.

    If only gitconfig would accept environment variables: Shell variable expansion in git config

提交回复
热议问题