在终端通过git config --global命令进行配置

git config --global user.email "xxx@xxmail.com"
git config --global user.name "xxx"
git config --global credential.helper store # git push的时候记住用户名和密码
git config --global push.default simple #从Git .0之后,push.default的默认值由'matching'改为'simple'

这几个命令实际上在操作用户目录下的.gitconfig文件, 其内容如下:

$ cat ~/.gitconfig
[user]
email = xxx@xxmail.com
name = xxx
[credential]
helper = store
[push]
default = simple

另外,如果没有配置push.default这一项,git push的时候会提示以下信息,可以看到matching方式和simple方式的区别:

warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name. Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch. See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

参考:

解决`向github提交代码是老要输入用户名密码`

最新文章

  1. JS处理四舍五入函数 toFixed(n)(可取小数点后n位)
  2. Apache配置文件服务器
  3. centos apache源码安装过程记录
  4. App开发流程之Xcode配置和本地化
  5. Nginx源码安装及调优配置
  6. python保留指定文件、删除目录其他文件的功能(1)
  7. 【LeetCode题意分析&解答】37. Sudoku Solver
  8. 【C语言探索之旅】 第二部分第一课:模块化编程
  9. Javaweb项目开发的前后端解耦的必要性
  10. C#之FTP上传下载(二)
  11. delphi
  12. Chapter 4 Invitations——8
  13. Android SharedPreferences增,删,查操作
  14. shell脚本总结
  15. StringBuffer类和String类(原文地址 : http://www.cnblogs.com/springcsc/archive/2009/12/03/1616330.html)
  16. centos 7 安装 BeautifulSoup 和requests
  17. [IIS | 用户权限] Connect as... 的设置
  18. yum安装lnmp
  19. Python_03-数据类型
  20. Codeforces 959 F. Mahmoud and Ehab and yet another xor task

热门文章

  1. visual studio中添加existing web site, website名字附带数字
  2. Putting Apache Kafka To Use: A Practical Guide to Building a Stream Data Platform-part 2
  3. [Linux]pycharm在Linux环境下安装
  4. 【python】argparse学习(转)
  5. mysql_fetch_assoc查询多行数据
  6. harbor 管理Helm Chart包
  7. 【转】asp.net 项目在 IE 11 下出现 “__doPostBack”未定义 的解决办法
  8. e.target和e.currentTarget区别
  9. [postgreSql]postgreSql数据库、模式、表、函数的删除与创建
  10. [Vue]Vue实例的选项props传递数据props为驼峰式命名