git在线练习平台
https://learngitbranching.js.org
配置文件
全局配置文件
全局配置文件有~/.gitconfig
和~/.git-credentials
两个
~/.gitconfig
对应着git config --global
命令。
//查
git config --global --list
git config --global user.name
//增
git config --global --add user.name fgq
//删
git config --global --unset user.name
//改
git config --global user.name fgq
比如修改GitHub账号名
git config --global user.name hansanf
~/.gitconfig
文件就会相应的做出修改
~/.git-credentials
中文是资格证书,里面保存github的token,使每次登陆都可以免密。
https://GitHub用户名:具体的token@github.com
局部配置文件
在使用 git init 文件目录
命令配置的git工作区中,即文件目录/.git/config
,是局部配置文件,对应着git config --local
命令。
.gitignore
也是只对当前工作区起作用,可以把要忽略的文件名填进去,然后Git就会自动忽略这些文件
示例:
# 忽略所有.开头的隐藏文件:
.*
# 忽略所有.class文件:
*.class
# 不忽略.gitignore和App.class:
!.gitignore
!App.class
参考:
修改git config配置文件