GitHub: Multiple account setup

后端 未结 4 1178
野性不改
野性不改 2020-12-08 17:53

I am trying since more than 3 hours to setting up multiple account for github and litteraly tired. I have tried out almost all possible way describe here, github and article

4条回答
  •  余生分开走
    2020-12-08 18:32

    I am using this script, that switch indentity and other all neccessary like git setting

    https://gist.github.com/milosjanda/a86ebc039293f22fabe723024ec42b46

    if [[ -f ~/.ssh/.work ]]; then
      echo "swith to HOME"
      # mv ~/.ssh/id_rsa ~/.ssh/work; mv ~/.ssh/home ~/.ssh/id_rsa
      rm ~/.ssh 2> /dev/null
      ln -s ~/.ssh-work/home ~/.ssh
      git config --global user.email "my.name@gmail.com"
    else
      echo "swith to WORK"
      # mv ~/.ssh/id_rsa ~/.ssh/home; mv ~/.ssh/work ~/.ssh/id_rsa
      rm ~/.ssh 2> /dev/null
      ln -s ~/.ssh-work/work ~/.ssh
      git config --global user.email "my.name@company.eu"
    fi
    
    # Delete all identities from ssh-agent
    ssh-add -D
    
    # Add new identity to ssh-agent
    ssh-add
    

提交回复
热议问题