Git 2.x 中git push时遇到 push.default 警告的解决方法
近在学习使用 git&GitHub,然后今天遇到了一个问题。在执行 git add 和 git commit 操作之后,再进行 git push 操作,出现了如下提示:
$ git push
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.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
然后来看看这一长串英文是在说什么:
警告:push.default (默认push)未设置;在Git 2.0 中,push.default 的值从‘matching’改为‘simple’了。消除此警告并保留以前的习惯,输入:
git config --global push.default matching
消除此警告并采用新的设置值,输入:
git config --global push.default simple
当 push.default 的值设置成 ‘matching’ ,git 将会推送所有本地已存在的同名分支到远程仓库
从 Git 2.0 开始,git 采用更加保守的值'simple',只会推送当前分支到相应的远程仓库,'git pull' 也将值更新当前分支。
……(后面就不译了)
已经说的很清楚了,Git 2.0 需要设置 push.default 的值,两者的区别上面也说了,所以我就采用新的保守值吧,输入:
git config --global push.default simple
然而接下来执行 git push 还是不顶用,因为上面警告的是两个问题,于是再次提示:
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
还没学到后面,就简单百度了一下,结果只是半懂,好像首次 push ,所以输入以下命令即可:
git push -u origin master
之后再直接执行 git push 就可以了。
作者:苏之辛
链接:https://www.jianshu.com/p/e26175b2e916
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
Git 2.x 中git push时遇到 push.default 警告的解决方法的更多相关文章
- Easyui中使用jquery或js动态添加元素时出现的样式失效的解决方法
Easyui中使用jquery或js动态添加元素时出现的样式失效的解决方法 2014-03-27 11:44:46| 分类: Easy UI|举报|字号 订阅 可以使用$.parser.pa ...
- universal image loader在listview/gridview中滚动时重复加载图片的问题及解决方法
在listview/gridview中使用UIL来display每个item的图片,当图片数量较多需要滑动滚动时会出现卡顿,而且加载过的图片再次上翻后依然会重复加载(显示设置好的加载中图片) 最近在使 ...
- iphone 开发中使用zbar时遇到的几个典型问题解决方法。
iphone 开发中使用zbar时遇到的几个典型问题解决方法. 在近期的一个ios项目中使用到了一个二维码扫描库(Qrcode)--ZBar, 期间遇到2个问题. 1. zbar下载后使用其l ...
- 史上最全的CSS hack方式一览 jQuery 图片轮播的代码分离 JQuery中的动画 C#中Trim()、TrimStart()、TrimEnd()的用法 marquee 标签的使用详情 js鼠标事件 js添加遮罩层 页面上通过地址栏传值时出现乱码的两种解决方法 ref和out的区别在c#中 总结
史上最全的CSS hack方式一览 2013年09月28日 15:57:08 阅读数:175473 做前端多年,虽然不是经常需要hack,但是我们经常会遇到各浏览器表现不一致的情况.基于此,某些情况我 ...
- 百度编辑器ueditor 异步加载时,初始化没办法赋值bug解决方法
百度编辑器ueditor 异步加载时,初始化没办法赋值bug解决方法 金刚 前端 ueditor 初始化 因项目中使用了百度编辑器——ueditor.整体来说性能还不错. 发现问题 我在做一个编辑页面 ...
- flask使用第三方云通讯平台时,出现{'172001':'网络错误'}解决方法
问题描述:flask使用第三方云通讯平台时,出现{'172001':'网络错误'} 解决方法: 在sms.py文件中添加如下代码 import ssl # 取消证书验证ssl._create_defa ...
- 安装CentOS、Linux系统时,GPT分区不能引导的解决方法
安装系统:CentOS 5.9_64bit时,分区后, 提示如下错误. 解决方法: 1.按ctrl+alt+F2 进入命令行 2.先查看分区 sh #fdisk -l 以下假设分区是/dev/s ...
- 关于真机调试DDMS中的data文件夹打不开的解决方法
关于真机调试DDMS中的data文件夹打不开的解决方法 今天在开发的时候需要导出程序中的数据库文件查看数据,数据库文件默认就在/data/data/应用包名/databases/数据库名 这个路径下, ...
- 加载驱动模块时Device or resource busy的解决方法
加载驱动模块时Device or resource busy的解决方法 加载驱动模块时Device or resource busy的解决方法 insmod或modprobe驱动模块时Device o ...
随机推荐
- MVC校验方式【六】
一.以往的校验都是自己写正则表达式校验,本篇讲的是通过MVC自带的jquery文件进行校验 实现步骤:1. 在webform页面中引入两个jquery文件,10,11行的代码. <%@ Page ...
- 力扣(LeetCode)561. 数组拆分 I
给定长度为 2n 的数组, 你的任务是将这些数分成 n 对, 例如 (a1, b1), (a2, b2), ..., (an, bn) ,使得从1 到 n 的 min(ai, bi) 总和最大. 示例 ...
- Python里面的write()方法写入文件时候的乱码解决方法
为了为今后的大数据以及人工智能的大潮流的到来做准备,最近在学Python,在这个过程中,会遇到许多汉字之间的转换,今天在写write方法的时候,发现写入的汉字会出现乱码,百思不得其解,上网查众资料,, ...
- Coding daily
@2017-7月 1可视化控件的awakeFromNib不调用? 因为用代码注册了cell 2scrollView添加子控件布局无效? 最好不要用masonry,直接用frame 还有tableVie ...
- 问题处理:Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
进入rails 文件夹, terminal输入rails console报告❌. 类似下面的 Running via Spring preloader Traceback (most recent c ...
- OO课程中IDEA相关插件的使用
写在前面 由于OO课程博客作业的需要分析代码的复杂度并绘制UML图,但是课件上推荐的分析工具(http://metrics.sourceforge.net )经过自己几个小时的折腾还是没有安装成功 ...
- C语言里有没有像C++里面的sort函数一样的函数?有!
C 库函数 - qsort() 描述 C 库函数 void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void ...
- 二、fread与fwrite
fread 原型:size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); 参数: ptr:数据存放地址 size:一个对象的 ...
- linux 创建sudo账号.md
内容来源自网络 方案一 root登录 ssh root@server_ip_address 新增用户 adduser username 设置密码 passwd username 输入两次密码 修改帐户 ...
- 转载 单例(Singleton)模式)的误区
在创建型模式中,单例(Singleton)模式和原型(Prototype)模式相对来说其用意更为简单明了.单例(Singleton)模式确保某类只有一个实例,且自行实例化并向整个系统提供这个实例:原型 ...