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

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

问题描述

我刚开始在github上使用git。我按照他们的指示,在最后一步遇到了错误。我正在检查一个当前不受源代码控制的现有目录(项目大约一周)。



以下是发生了什么:

  $ git push origin master 
错误:src refspec master不匹配任何。
致命:远程端意外挂起
错误:未能将一些文件推送到'git@github.com:{username} / {projectname} .git'
 全局设置:



Github的指示:

下载并安装Git
git config --global user.nameYour Name
git config --global user.email {username}@gmail.com

后续步骤:

mkdir项目名称
cd项目名称
git init
touch自述文件
git add自述文件文件
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 ,它会将它重命名为 master on github)或者先做一个提交。您无法推送完全空的存储库。


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.

Here's what's happening:

$ 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'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

解决方案

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天全站免登陆