Git - fatal the current branch master has no upstream branch

简介: Git - fatal the current branch master has no upstream branch

问题描述

今天在使用git时,在本地新建了一个分支,按照网上搜到的方式使用 git branch --set-upstream dev origin/dev (这里的dev为本地新建的分支)命令建立本地分支与远程分支的关联,但该命令执行后并不能成功push变更到远程分支。


解决方案

出现上述问题,说明远程并没有感知到本地新建的这个分支,经过多种尝试后,发现一旦执行 git branch --set-upstream 命令后本地与远程的关联要是仍旧没有建立成功,则再次执行 git push -u origin dev 即可成功建立本地与远程的关联。


git push -u origin dev


Ps:第一次提交使用上述该命令,就自动在本地分支和远程分支建立关联,以后只需,git push 即可!


目录
相关文章
|
3月前
|
开发工具 git
git branch (branchname)
git branch (branchname) 是 Git 中创建和管理分支的一种命令。通过这个命令,你可以根据指定的分支名创建一个新的分支,或者跳转到已经存在的分支上。branchname 参数是可选的,如果不指定,则默认创建或切换到主分支(master 或 main)。
65 8
|
14天前
|
网络安全 数据安全/隐私保护
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
|
20天前
|
开发工具 git
避免git产生Merge branch 'foo' into 'bar'提交
避免git产生Merge branch 'foo' into 'bar'提交
34 3
|
25天前
|
开发工具 git
完美解决git 执行git push origin master指令 报错command not found
完美解决git 执行git push origin master指令 报错command not found
32 0
|
1月前
|
开发工具 git 开发者
git 解决(master|REBAS1/1)
git 解决(master|REBAS1/1)
30 0
|
1月前
|
开发工具 git
对于github不同的分支main或者master,git拉取代码的时候怎么拉取不同分支的代码
对于github不同的分支main或者master,git拉取代码的时候怎么拉取不同分支的代码
24 1
|
5月前
|
开发工具 git
解决:fatal: not a git repository (or any of the parent directories): .git的问题
解决:fatal: not a git repository (or any of the parent directories): .git的问题
|
6月前
|
开发工具 git
git push origin master提交报错解决办法
git push origin master提交报错解决办法
80 0
|
开发工具 git 开发者
git 创建branch分支【转】
转自:http://www.cnblogs.com/jackluo/p/3499731.html   开发者user1 负责用getopt 进行命令解析的功能,因为这个功能用到getopt 函数,于是将这个分支命名为user1/getopt.
705 0