问题:当我执行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. Redis缓存异常及解决方案

    本文分享自天翼云开发者社区<Redis缓存异常及解决方案>,作者:l****n 本文向读者解释了Redis使用过程中,数据不一致.缓存雪崩.缓存击穿和缓存穿透等问题的定义,并给出对应的解决 ...

  2. 免费的天气接口api(腾讯)

    请求URL: https://wis.qq.com/weather/common请求方式: GET参数: 参数名 必选 类型 说明 source 是 string pc weather_type 是 ...

  3. 1.Vue3 配置开发-测试环境

    1.根目录新建.env.testing..env.donline文件 2.package.json=>scripts中配置 "start": "vue-cli-se ...

  4. 使用PhantomJS解决VUE项目无法被百度收录

    一.安装PhantomJS 安装文章:https://www.cnblogs.com/robots2/p/17340143.html 二.编写脚本spider.js // spider.js 'use ...

  5. 普通人也能轻松掌握的20个DeepSeek高频提示词(2025版)

    一.基础原则 1️⃣ 说人话最重要 "不用专业术语,就像和朋友聊天一样描述需求". ️ 错误示范:"请用SWOT分析法输出新能源汽车行业报告". 正确示范:&q ...

  6. MacOS15+Xcode版本16+对ReactNative项目进行编译和上传到APPStore的踩坑记录

    作者:Kovli 重要通知:红宝书第5版2024年12月1日出炉了,感兴趣的可以去看看,https://u.jd.com/saQw1vP 红宝书第五版中文版 红宝书第五版英文原版pdf下载(访问密码: ...

  7. GridControl 给选中的行添加边框显示

    实现方式,通过自定义 RowControl 的样式实现. 参考:https://supportcenter.devexpress.com/ticket/list?searchString=RowCel ...

  8. 使用crewai创建属于你自己的AI团队

    crewai介绍 CrewAI 是一个用于协调自主 AI 代理的前沿框架. CrewAI 允许你创建 AI 团队,其中每个代理都有特定的角色.工具和目标,协同工作以完成复杂任务. 把它想象成组建你的梦 ...

  9. 分享一个裁剪图片Chrome 扩展 —— Crop Image

    1. 前言 在日常工作和设计过程中,我们常常需要对图片进行裁剪,以适配不同的使用场景.无论是社交媒体头像.网站图片优化,还是艺术设计,精确的图片裁剪都是必不可少的.然而,许多在线工具使用复杂,或者功能 ...

  10. goland JetBrains编辑器:代码爆红找不到引用,但项目可运行

    前言 goland JetBrains 编辑器:代码爆红找不到引用,但项目可运行 解决 goland 缓存已满,需要清除缓存