git pull push没有指定branch报错的解决方法
2016-03-15 11:32
513 查看
git 执行git push 和git pull的操作时候,经常看到下面的提示:
You asked me to pull without telling me which branch you
want to merge with, and 'branch.dev.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "dev"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
在高版本的 git下面,也许会看见这样的提示:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with
git branch --set-upstream master origin/<branch>
看到第二个提示,我们现在知道了一种解决方案。也就是指定当前工作目录工作分支,跟远程的仓库,分支之间的链接关系。
比如我们设置master对应远程仓库的master分支
git branch --set-upstream master origin/master
这样在我们每次想push或者pull的时候,只需要 输入git push 或者git pull即可。
在此之前,我们必须要指定想要push或者pull的远程分支。
git push origin master
git pull origin master.
You asked me to pull without telling me which branch you
want to merge with, and 'branch.dev.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "dev"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
在高版本的 git下面,也许会看见这样的提示:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with
git branch --set-upstream master origin/<branch>
看到第二个提示,我们现在知道了一种解决方案。也就是指定当前工作目录工作分支,跟远程的仓库,分支之间的链接关系。
比如我们设置master对应远程仓库的master分支
git branch --set-upstream master origin/master
这样在我们每次想push或者pull的时候,只需要 输入git push 或者git pull即可。
在此之前,我们必须要指定想要push或者pull的远程分支。
git push origin master
git pull origin master.
相关文章推荐
- 自动生成四则运算题目
- ios 根据字符串中的逗号分行显示
- 辛星算法教程第一节即二叉树的递归遍历
- JSP生成验证码
- Android学习笔记50:使用WebView控件浏览网页
- jQuery easyUI动态的课表
- MVC设计模式
- 关于Struts2异常或错误不输出到控制台原因
- 由backgroud所引起的视觉大小问题。
- C++引入名字空间(namespace)意义何在?为什么using namespace std会成为常用语句?
- 关于Block的copy和循环引用的问题
- 基于Material Design设计的分享文字图片的APP
- springmvc学习笔记(22)-springmvc开发小结
- PHP中使用CURL实现GET和POST请求(详细)
- ubuntu基本使用总结(不断更新中。。。
- Android UI 优化——使用HierarchyViewer工具
- Centos6.7下面配置vim及其插件
- 编程之美之将帅问题
- python内建方法
- 保存--php判断手机移动设备访问