在新存储库上推送原始主错误 [英] Push origin master error on new repository

查看:28
本文介绍了在新存储库上推送原始主错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始在 github 上使用 git.我按照他们的指示,在最后一步遇到了错误.我正在检查当前不受源代码控制的现有目录(大约一周前的项目).除此之外,我的用例应该是完全正常的.

I just started using git with github. I followed their instructions and ran into errors on the last step. I'm checking in an existing directory that isn't currently source-controlled (project about a week old). Other than that, my use case should be pretty run of the mill.

这是正在发生的事情:

$ git push origin master
error: src refspec master does not match any.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'git@github.com:{username}/{projectname}.git'

Github 的说明:

Github's instructions:

Global setup:

  Download and install Git
  git config --global user.name "Your Name"
  git config --global user.email {username}@gmail.com

Next steps:

  mkdir projectname
  cd projectname
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin git@github.com:{username}/{projectname}.git
  git push origin master

推荐答案

该错误消息导致您的本地存储库中没有 master 分支的结论.要么推送您的主要开发分支(git push origin my-local-master:master 它将在 github 上将其重命名为 master)或先进行提交.你不能推送一个完全空的仓库.

The error message leads to the conclusion that you do not have a master branch in your local repository. Either push your main development branch (git push origin my-local-master:master which will rename it to master on github) or make a commit first. You can not push a completely empty repository.

这篇关于在新存储库上推送原始主错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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