发现问题

本地新建了一个dev分支,然后把dev分支下的代码push到远程仓库中,使用git push,但是报错了,如下:

fatal: The current branch dev has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin dev

翻译
错误:当前分支:dev没有远程对应的dev分支。
要推动当前分支并将远程设置为上游,请使用。。。

原因

首先git push命令,是默认将当前分支Push到远程的对应的分支,如果远程不存在对应分支,则会报错。比如这里,本地是dev分支,远程没有dev分支,使用这条命令默认就是对应远程dev分支,所以就会报错。

解决方法

方法1

根据提示的命令git push --set-upstream origin dev,这条命令是将远程也重新创建一个分支dev,这样就匹配了,然后再push

执行完毕后,远程就会多出一个dev分支,并且我的代码也更新在了上面

方法2

指定分支push

【git报错】The current branch dev has no upstream branch. To push the current branch and set the remote相关推荐

  1. git报错Connection reset by 140.82.113.4 port 22

     git报错如下: Connection reset by 140.82.113.4 port 22 fatal: Could not read from remote repository. Ple ...

  2. git 本地新建分支上传报错The current branch dev has no upstream branch.To push the current branch and setremote

    项目本地初始化后,commit执行完毕,然后执行git push,报如下错误: $ git push fatal: The current branch dev has no upstream bra ...

  3. Git报错:fatal: The current branch main has no upstream branch

    Git报错:fatal: The current branch main has no upstream branch 参考:https://blog.csdn.net/benben_2015/art ...

  4. GIT 报错:Branch ‘master‘ set up to track remote branch ‘master‘ from ‘origin‘

    GIT 报错:Branch 'master' set up to track remote branch 'master' from 'origin' git上传仓库时报错 解决方法共两步 1.移除 ...

  5. git push 出现 The current branch dev has no upstream branch.的问题

    git push 出现 The current branch dev has no upstream branch.的问题 原因:本地分支没有和远程分支关联,导致无法push 解决方法:git pus ...

  6. fatal: The current branch dev has no upstream branch. To push the current branch and set the remote

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

  7. 【git报错】unable to resolve reference ‘ORIG_HEAD‘: reference broken

    [git报错]unable to resolve reference 'ORIG_HEAD': reference broken git报错::fatal: update_ref failed for ...

  8. npm run dev 报错:missing script:dev

    错误描述 运行 npm run dev 报错 missing script:dev 原因 查看package.json发现script中并没有dev而是serve.. 所以运行 npm run ser ...

  9. git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists)....

    Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists). 解决办法一:保 ...

最新文章

  1. ES6 WeakMap的实际用途是什么?
  2. Python中的join()函数和split()函数的用法
  3. 9.关于Unicode字符集
  4. 【Word】一些实用的小技巧
  5. C++/C--字符串分割函数 --strtok()
  6. 用Ultra ISO制作启动U盘装系统
  7. Windows Phone 7 Jump Start 系列教程
  8. EasyGUI 学习文档
  9. 一座5g基站造价多少?
  10. Derivation of Linear Regression with One Variable
  11. vue-devtools工具点击open in editor 自动跳转到对应的组件页面
  12. 计算机学士学位英文翻译,各类学士、硕士和博士学位英文翻译及缩写
  13. 回文是指正读反读均相同的字符序列;如“abba”和“abdba”均是回文,但“good”不是回文。试写一个算法判定给定的字符序列是否是回文。(提示:将一半字符入栈)
  14. pr学习心得(入门篇)
  15. Data transformation R语言与python
  16. mysql mts_MySQL新特性MTS
  17. Python 绘制e^x,e^-x,e^x/x,e^-x/x,e-2x/x,e^-3x/x,ln(x)图像
  18. vb.net 教程 1-9 数组3
  19. 常见的色谱法有哪些?分别有哪些特点?
  20. 使用 qt 在 windows 下开发云盘软件

热门文章

  1. 猎豹免费WiFi V4.0
  2. 吃的亿万市场里,菜谱软件是怎样占据了山头?
  3. 樱花飘落python_樱花之吻(python.turtle)
  4. 【计算机毕业设计】招聘信息系统
  5. Android投篮验证,投篮验证使用说明(Android和iOS)
  6. 将图片转换成PDF格式的方法讲解
  7. 信息化实战展示系列3 **市**区行政审批系统
  8. 十八、新人成才之路《做人七项原则 做一个端庄律己的人 之 心胸端正》
  9. 《Android 第一行代码》十一章 “服务的最佳实践”
  10. 艺术签名制作软件有什么?这篇文章来告诉你