admin管理员组

文章数量:1612099

git本地仓库push远程仓库的时候,报了异常:fatal the current branch master has no upstream branch
经过查询发现目前有两种解决方案:

1.翻译后大致意思是,远程仓库创建时候要建立一个README文件,然后再进行push操作。因为这个文件是远程仓库主分支所必须的,见如下截图。

Create the repo on github; add a README file on github and then clone the github repository. Creating the README file (or any file actually) is needed in order to get a master branch.Notice how github prompts for creating a README when creating a repository:

2.翻译后大致意思是,如果不想重新创建远程仓库再克隆(针对方案1),或者初始化本地仓库,可以使用下面命令: git push -u origin master,其中origin 表示远程仓库名称,master是远程仓库的push目标分支。-u (推测为update缩写^_^~)表示本地分支将建立对远程仓库目标分支的检测,如果远程仓库目标分支不存在,将新建分支再push;如果存在,将进行push更新。

Instead of creating a new repository on Github, cloning that, or reinitializing your local repository, the following command would have been sufficient:

最后用第二种方法 搞定!

本文标签: CurrentFATALGitupstreamMaster