Hiding GitHub token in .gitconfig

后端 未结 4 1451
失恋的感觉
失恋的感觉 2021-02-05 10:27

I would like to store all of my dotfiles on GitHub, including .gitconfig which requires me to hide the GitHub token in the .gitconfig.

To do so I have a \".gitconfig-hid

4条回答
  •  遥遥无期
    2021-02-05 10:59

    I just fixed this up for myself. The "proper" way to solve the issue is to split your gitconfig into two files, a public one with the alias/config/etc, and a private file that keeps your username and secrets. Like so...


    From https://github.com/ddopson/dotfiles ...

    .gitconfig:
    [include]
      # For username / creds / etc
      path = ~/.gitconfig.local
    
    [alias]
      ... 
    
    .gitconfig.local:
    [user]
      user = ddopson
      name = Dave Dopson
      email = ddopson@gmail.com
      token = a123uber456secret789ceprivate000key78
    
    [credential]
      helper = osxkeychain
    
    .gitignore:
    /.gitconfig.local
    

提交回复
热议问题