git config(转载)

From:http://www.g2w.me/2013/10/cache-github-credential-for-https-repository/

http://openwares.net/linux/gerrit_workflow.html

git config --system  配置全局           对应/etc/gitconfig

git config --global   配置当前用户      对应/root/.gitconfig文件

git config               配置当前版本库   对应版本库下.git/config

用户信息配置:
git config user.name <username> git config user.email <email>
编辑器配置: git config core.editor vim git config core.color auto
颜色配置:
git config color.status auto
git config color.diff auto
git config color.branch auto
git config color.interactive auto
一次性打开所有颜色:
git config color.ui true
日志格式:
git config format.pretty oneline
提交模板:
git config commit.template '/etc/git-commit-template'
 

配置http仓库密码

使用http地址访问仓库时,每次进行push操作都会提示输入用户名和密码,比较麻烦。可以进行配置。

对于1.7.9及之后的版本

git config --global credential.helper cache    

如果需要加上失效时间,可以如下配置

git config credential.helper 'cache --timeout=3600'

则密码会在1小时后失效

存储在磁盘上

git config --global credential.helper store

对于1.7.9之前的版本

需要显式的在git地址中加入用户名和密码,如https://you:password@github.com/you/example.git

git config remote.origin.url https://you:password@github.com/you/example.git

修改提交者的用户名和邮箱:

git commit --amend --author='Your Name <you@example.com>'

 查看配置信息:

git config --list

 更多配置,查看git config官方配置文档

配置http密码:https://www.kernel.org/pub/software/scm/git/docs/git-credential-store.html

查看日志git log

原文地址:https://www.cnblogs.com/xiaoerlang/p/3595586.html