Git主分支没有上游分支 [英] Git master branch has no upstream branch

查看:490
本文介绍了Git主分支没有上游分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的一个项目推送到github,但我不断收到此错误:

I'm trying to push one of my projects to github, and I keep getting this error:

fatal: The current branch master has no upstream branch.

我以前从未见过.我重新初始化了git,重新添加了源,删除并重新制作了存储库,并重新创建了SSH密钥.

I've never seen this before. I re-initialized my git, re-added my origin, deleted and re-made the repo, and recreated my SSH key.

推荐答案

在github上创建存储库;在github上添加一个README文件,然后克隆github仓库.为了获得master分支,需要创建README文件(或实际上的任何文件).

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.

注意创建存储库时github如何提示创建自述文件:

Notice how github prompts for creating a README when creating a repository:

这篇关于Git主分支没有上游分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆