问题:当我执行git push命令的时候,报错如下:

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream

当前分支主服务器没有上游分支,推送当前分支并将远程服务器设置为上游

复现

首先创建远程仓库,然后在本地

git init
git remote add origin https://username@xxx.com/xxx.git
git add .
git remote add origin
git push

然后报错

解决办法

git pull

git push --set-upstream origin master(master可以根据你的需要自定义,就是当前分支在远程分支对应的名称)

Git错误,fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream的更多相关文章

  1. Git:错误:error:src refspec master does not match any

    新建立了一个远程仓库,想着把项目放上去.于是在项目目录上: git init 然后就添加远程库 git remote add origin xxxx.git 然后就想push: git push -u ...

  2. git 错误 fatal: Not a valid object name: 'master'

    问题场景:新建git项目或刚为已存在项目创建了git仓库,想用git branch dev创建dev分支或用git checkout -b dev创建并切换到dev分支时报错. 原因:刚创建的git仓 ...

  3. git 错误 fatal: loose object...is corrupt

    错误描述: error: object file .git/objects/9a/83e9c5b3d697d12a2e315e1777ceaf27ea1bab is empty fatal: loos ...

  4. 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:/ ...

  5. git push时提示"fatal: The current branch master has no..."

    git push到远程仓库时提示:fatal: The current branch master2 has no upstream branch. To push the current branc ...

  6. Git hub pull时候的错误 : The current branch is not configured for pull No value for key branch.master.merge found in configuration

    网上多半都是命令行下的解决方案,我用的是EGit,所以要在eclipse里(我的版本是kepler)把下面这句话添加到配置文件中. Window->Preference->Team-> ...

  7. 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 ...

  8. 解决Git报错:The current branch is not configured for pull No value for key branch.master.merge found in configuration

    1.在本地工程目录找到config文件(我的是在D:\git\demo\.git):2.修改config文件内容为: [core] repositoryformatversion = 0 filemo ...

  9. git:解决The current branch is not configured for pull No value for key branch.master.merge found in config

    网上多半都是命令行下的解决方案,我用的是EGit,所以要在eclipse里(我的版本是kepler)把下面这句话添加到配置文件中. Window->Preference->Team-> ...

  10. 解决The current branch is not configured for pull No value for key branch.master.merge found in config

    使用Git Pull项目的时候出现这个问题: The current branch is not configured for pull No value for key branch.master. ...

随机推荐

  1. flutter3-dymall仿抖音直播商城|Flutter3.27短视频+直播+聊天App实例

    自研flutter3.27+dart3.6+getx实战抖音短视频+聊天+直播电商带货app商城应用. flutter_dymall一款基于最新版Flutter3.27+Dart3.x+Getx+me ...

  2. Linux名词介绍

    AVX2:高级向量扩展指令集(英语:Advanced Vector Extensions,简称AVX)是x86架构微处理器中的指令集, AVX2指令集将大多数整数命令操作扩展到256位,并引入了熔合乘 ...

  3. python 爬取博客访问量

    一.代码 """ Version: Python3.5 Author: OniOn Site: http://www.cnblogs.com/TM0831/ Time: ...

  4. 使用idea合并 dev分支合并到test分支

    这里展示将dev分支合并到test分支首先切换到test分支 按下图所示操作

  5. MyBatis mapper.xml中SQL处理小于号与大于号 和小于等于号

    这种问题在xml处理sql的程序中经常需要我们来进行特殊处理. 其实很简单,我们只需作如下替换即可避免上述的错误: < <= > >= & ' " < ...

  6. mysql数据库表如何设计

    单表数据量 所有表都需要添加注释,数据量建议控制在3000万以内 不保存大字段数据 不在数据库中存储图片.文件等大数据 表使用规范 拆分大字段和访问频率低的字段,分离冷热数据 单表字段数控制在 20 ...

  7. JUC并发—12.ThreadLocal源码分析

    大纲 1.ThreadLocal的特点介绍 2.ThreadLocal的使用案例 3.ThreadLocal的内部结构 4.ThreadLocal的核心方法源码 5.ThreadLocalMap的核心 ...

  8. Flume - [08] 绝密档案Ⅰ

    题记部分 (1)Flume使用场景   线上数据一般主要是落地(存储到磁盘)或者通过socket传输给另一个系统,这种情况下,你很难推动线上应用或服务去修改接口,实现直接向kafka里写数据,这时候你 ...

  9. Ansible - [01] 入门&安装部署

    自动化运维工具,可以批量远程其他主机并进行管理操作 一.什么是 Ansible Ansible首次发布于2012年,作者:Michael DeHaan,同时也是Cobbler的作者,Ansible于2 ...

  10. 一文搞懂 MCP Servers

    一文搞懂 MCP Servers 什么是MCP MCP概念 MCP(Model Context Protocol,模型上下文协议)是由 Anthropic 提出并于 2024 年 11 月开源的一种通 ...