Git master branch has no upstream branch的解决
Git master branch has no upstream branch的解决
在push代码时,出现“git master branch has no upstream branch”问题的原因是没有将本地的分支与远程仓库的分支进行关联。如下图所示:
具体原因: 出现这种情况主要是由于远程仓库太多,且分支较多。在默认情况下,git push时一般会上传到origin下的master分支上,然而当repository和branch过多,而又没有设置关联时,git就会产生疑问,因为它无法判断你的push目标。
Git 的 “master” 分支并不是一个特殊分支。 它就跟其它分支完全没有区别。 之所以几乎每一个仓库都有 master 分支,是因为
git init命令默认创建它,并且大多数人都懒得去改动它
远程仓库名字 “origin” 与分支名字 “master” 一样,在 Git 中并没有任何特别的含义一样。origin” 是当你运行
git clone时默认的远程仓库名字。 如果你运行 git clone -o booyah,那么你默认的远程分支名字将会是 booyah/master。
解决办法其实就是确定这两个值,方法有两种:
- 第一种如上图中的提示:
git push --set-upstream origin master。其中的origin是你在clone远程代码时,git为你创建的指向这个远程代码库的标签,它指向repository。为了能清楚了解你要指向的repository,可以用命令git remote -v进行查看。master是你远程的branch,可以用git branch -a查看所有分支,远程分支是红色的部分。然后确定好这两个值后,将值换掉即可。 - 另一种方法是:
git push -u origin master。同样根据自己的需要,替换origin和master。
两个命令的区别是第一条命令是要保证你的远程分支存在,如果不存在,也就无法进行关联。而第二条指令即使远程没有你要关联的分支,它也会自动创建一个出来,以实现关联。
---------------------
本文来自 benben_2015 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/benben_2015/article/details/78803753?utm_source=copy
Git master branch has no upstream branch的解决的更多相关文章
- git推送代码报错:fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream
情景再现 远程新建仓库,然后本地 git bash执行以下代码 git init git add . git commit -m 'xxx' git remote add origin https:/ ...
- 【IDEA】 Can't Update No tracked branch configured for branch master or the branch doesn't exist. To make your branch track a remote branch call, for example, git branch --set-upstream-to origin/master
IDEA点击GIT更新按钮时,报错如下: Can't UpdateNo tracked branch configured for branch master or the branch doesn' ...
- [Practical Git] Switching between current branch and last checkout branch
When working on a project, it is much easier to work on features and bugs in isolation of the rest o ...
- git merge,rebase和*(no branch)
上一篇:http://blog.csdn.net/xiaoputao0903/article/details/23933589,说了git的分支,相关的使用方法没说到可是仅仅要google就能搜出一大 ...
- git常见问题之git pull时Please specify which branch you want to merge with.
$ git pull时遇到如下提示 $ git pull warning: no common commits remote: Counting objects: 5, done. remote: C ...
- Git 协作:Fetch Pull Push Branch Remote Rebase Cherry-pick相关
前言 学习git的时候,我们首先学习的是最常用的,自己独立开发Software时用的命令: git init //初始化git仓库 git add <file_name> //将文件添加到 ...
- eclipse git 一个错误:the current branch is not configured for pull No value for key branch.xxx.merge found
eclipse git 一个错误:the current branch is not configured for pull No value for key branch.xxx.merge fou ...
- git 报错 gitThere is no tracking information for the current branch. Please specify which branch you w
新建本地分支后将本地分支推送到远程库, 使用git pull 或者 git push 的时候报错gitThere is no tracking information for the current ...
- Git master合并分支时提示“Already up-to-date”
Git master合并分支时提示"Already up-to-date" 在使用Git把当前分支合并到master提示"Already up-to-date&quo ...
随机推荐
- linux 内存释放命令
我使用的是CentOS 6.5 ,由于卸载Solr 后发现内存占用挺多的,我想释放一下内存,就查阅了一些资料,分享给大家: 1.free -m 查看内存的使用情况,-m表示单位是兆 2.echo 1 ...
- 西安电子科技大学第16届程序设计竞赛 F Operating System (unique() 去重函数)
链接:https://www.nowcoder.com/acm/contest/107/F来源:牛客网 Operating System 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ ...
- canvas绘制中的API
canvas绘制Z 先贴代码吧: /** * Created by Administrator on 2016/1/26. */ var i; function draw (id){ var canv ...
- C# 保存文件如有重名在原名后加(*)
C#保存文件如有重名加() **(1) //Myadd 处理重名 private string GetNewPathForDupes(string path) { string directory = ...
- nc之一:NetCat简介与使用方法
精品学习网考试频道小编应广大考生的需要,特为参加考试的考生策划了“NetCat简介与使用方法”专题等有关资料,供考生参考! 在入侵中它是最经典的工具之一 ,NetCat被所有的网络安全爱好者和研究者称 ...
- 人脸检测学习笔记(数据集-DLIB人脸检测原理-DLIB&OpenCV人脸检测方法及对比)
1.Easily Create High Quality Object Detectors with Deep Learning 2016/10/11 http://blog.dlib.net/201 ...
- JeeSite入门介绍(一)
JeeSite特点:高效.高性能.强安全性属于开源.JavaEE快速开发平台:接私活的最佳助手: JeeSite是在Spring Framework基础上搭建的一个Java基础开发平台,以Spring ...
- DataGrid 单元格输入验证 由ValidatingEditor事件完成
private void gdv_reguline_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContai ...
- paramiko 模块封装
#!/usr/bin/env python#coding=utf-8 import paramiko, getpass,sys,traceback class ssh_utils(): def log ...
- IRedisClient
事实上,IRedisClient里面的很多方法,其实就是Redis的命令名.只要对Redis的命令熟悉一点就能够非常快速地理解和掌握这些方法,趁着现在对Redis不是特别了解,我也对着命令来了解一下这 ...