在终端通过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提交代码是老要输入用户名密码`

[Github] 本地git push免用户名和密码的配置的更多相关文章

  1. git push免输入账号和密码方法

    最近在做些oj,所以需要频繁的git push提交代码,每次都要输入帐号和密码,感觉不舒服,于是乎就做了如下设置,然后就可以开心的提交啦- Linux或者Mac下方法: 创建文件,进入文件,输入内容: ...

  2. Git Push 避免用户名和密码方法

    参考这里: http://www.cnblogs.com/ballwql/p/3462104.html 亲测第一种方法有效

  3. GIT(4)----免输入账号和密码方法

    1.全局方式 包删除了,再次下载也不需要在配置输入密码和用户名 参考资料:git pull 和 git push免输入账号和密码方法 2.局部方式 包删除了,密码用户也会被删除,需要重新设置 打开终端 ...

  4. 使用git提交到github,每次都要输入用户名和密码的解决方法

    使用git提交文件到github,每次都要输入用户名和密码,操作起来很麻烦,以下方法可解决,记录以下. 原因:在clone 项目的时候,使用了 https方式,而不是ssh方式. 默认clone 方式 ...

  5. git push 免密码

    git push 免密码 通用情况 使用ssh协议 git add 使用tab键自动补全的中文文件名乱码 jupyter notebook 创建密码 git push 免密码 通用情况 1.使用文件创 ...

  6. 使用git提交代码到github,每次都要输入用户名和密码的解决方法

    自从使用git提交代码到github后,发现自己使用git的功力增长了不少,但也遇到不少问题.比如,使用git提交代码到github的时候,经常要求输入用户名和密码,类似这种: 网上有这么一种解决方法 ...

  7. git 中添加用户名和密码

    git 中添加用户名和密码:https://blog.csdn.net/qq_28602957/article/details/52154384 在使用git时,如果用的是HTTPS的方式,则每次提交 ...

  8. 宝塔webhook配合码云,本地git push 服务器自动pull

    emmmm,这其实是一个很简单的一件事情,但是有很多坑,记录一下 先大概讲一下原理吧,就是每次您 push 代码后,都会给远程 HTTP URL 发送一个 POST 请求 更多说明 » 然后在宝塔这边 ...

  9. 让git push命令不再需要密码

    最近利用jekyll写博客,为的就是博客管理方便,但是在上传博客的时候使用git push命令每次都得输入github帐号和密码特别的不方便,于是就搜了一下. 在这篇文章里提到,GitHub获得远程库 ...

随机推荐

  1. 置顶,置低实现与window.scroll

    //置顶,置低实现 $('#updown .up').click(function(){$('html,body').animate({scrollTop: '0px'}, 300);}); $('# ...

  2. Extjs 分页多选的实现

    Extjs 版本 6.X 单页面的多选,没有任何问题. 直接使用 Grid的配置项进行绑定即可获取: xtype: 'grid', bind: { selection: '{checkedRecord ...

  3. spring boot 国际化MessageSource

    转自:https://blog.csdn.net/flowingflying/article/details/76358970 spring中ResourceBundleMessageSource的配 ...

  4. 解决 ORA-28001: the password has expired 问题

    1.首先需要使用dba登录. 2.运行SQLPlus命令行工具, 输入: connect as sysdba; 3.输入dba的用户名和密码后进行 4.ALTER USER 用户名 IDENTIFIE ...

  5. 14.并发容器之ConcurrentHashMap(JDK 1.8版本)

    1.ConcurrentHashmap简介 在使用HashMap时在多线程情况下扩容会出现CPU接近100%的情况,因为hashmap并不是线程安全的,通常我们可以使用在java体系中古老的hasht ...

  6. Python不同版本切换

    2016年6月8日更新: 这是我早前写的一篇小文章,其实,后来也没有采用这种方法切换.电脑上安装了多个Python 版本,保证自己经常用的版本加入环境变量外,使用非系统的版本时一般使用 IDE 编辑器 ...

  7. day5-os、sys模块

    一.概述 开发运维相关支撑系统现今已成为Devops下的一大热门领域,Python在这方面也有着自己独到的优势.这类场景以及其他一些场景下,需要调用一些操作系统的接口,这就涉及到今天要讲述的OS模块和 ...

  8. PHP---初探PHP

    初探PHP 虽然说前后端分离,但作为前端还是要跟数据打交道的,所以对后台语言的了解还是很有必要的.今天要学的就是PHP. 什么是PHP? PHP(外文名:PHP: Hypertext Preproce ...

  9. caffe:自己搭建网络来训练

    1.准备样本 要训练自己的样本,首先需要把样本准备好,需要准备的是训练集和测试集,caffe支持直接使用图片,当然把样本转换为leveldb或lmdb格式的话训练起来会更快一点.这里我先偷个懒,直接使 ...

  10. Qt:表格 tableWidget

    1.设置行数和列数 //设置行数 tableWidget->setRowCount(); //设置列数 tableWidget->setColumnCount(); 2.隐藏表头 tabl ...