Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 在新存储库上推送源主机错误_Git_Github - Fatal编程技术网

Git 在新存储库上推送源主机错误

Git 在新存储库上推送源主机错误,git,github,Git,Github,我刚开始在github中使用git。我遵照他们的指示,在最后一步遇到了错误。我正在签入一个当前不受源代码控制的现有目录(大约一周前的项目)。除此之外,我的用例应该是非常普通的 下面是正在发生的事情: $ 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 '

我刚开始在github中使用git。我遵照他们的指示,在最后一步遇到了错误。我正在签入一个当前不受源代码控制的现有目录(大约一周前的项目)。除此之外,我的用例应该是非常普通的

下面是正在发生的事情:

$ 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的说明:

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推送origin my local master:master
,它将在github上将其重命名为
master
),或者首先进行提交。你不能推送一个完全空的存储库。

我解决了我的问题

 git remote add origin git@github.com:Odd-engine
不确定是什么问题,但使用gitx接口提交我的暂存文件,然后

$ git push origin master
工作了…

我也有同样的问题

已在bort模板文件中创建新文件夹

$ git commit -m 'first commit'

$ git remote add origin git@github.com:eltonstewart/band-of-strangers.git

$ git push origin master
然后我得到同样的错误

错误:src refspec master不匹配任何参数。
致命:远程端意外挂起
错误:无法将某些引用推送到'git@github.com:eltonstewart/一群陌生人。git'


我也犯了同样的错误,因为Bombe说我的配置中没有名为master的本地分支,尽管
git branch
确实列出了名为master的分支

要修复它,只需将其添加到您的.git/config

[branch "master"]
    remote = origin
    merge = refs/heads/master
有点老套,但能胜任

error: failed to push some refs to 'git@github.com:{username}/{projectname}.git'

除非您将错误消息泛化,否则它看起来就像您将
git@github.com:{username}/{projectname}.git
作为您的远程git repo。你应该用你的GitHub用户名填写
{username}
,用你的项目名称填写
{projectname}

我也有同样的问题,然后打了自己的头,因为我没有实际添加我的项目文件

git add -A
git commit -am "message"
git push origin master

我错误地在-so后面加了一个空格,而不是-m
只是一些需要寻找的东西。

我认为在较旧版本的git中,您应该首先提交至少一个文件,然后可以再次“推送原始主机”。

太好了。。这是空目录的问题,没有别的。我通过在每个目录中创建一个二进制文件并添加它们来解决问题。

为了实际解决问题,我使用以下命令将我的所有文件转移到提交

$ git add .
$ git commit -m 'Your message here'
$ git push origin master

我遇到的问题是git add中的-u命令实际上并没有添加新文件,而且git add-A命令在我安装的git上不受支持。因此,正如在本线程中所提到的,我试图提交的提交是空的。

初始添加和提交工作非常有效。我想这只是理解Git在存储库中管理项目的方法的问题

 git remote add origin git@github.com:Odd-engine

在那之后,我成功地将数据直接推送出去,没有任何麻烦。

一分钟前也有同样的问题,然后修复了它

cd  app 

git init 

git status 

touch  test 

git add . 

git commit  -a  -m"message to log " 

git commit  -a  -m "message to log" 

git remote add origin 

 git remote add origin git@git.google.net:cherry 

git push origin master:refs/heads/master

git clone git@git.google.net:cherry test1
在github中创建一个名为wordpress的存储库

cd wordpress
git init
git add -A
git commit -am “WordPress 3.1.3″ or any message
git remote add origin git@github.com:{username}/wordpress.git
git push -u origin master

这应该可以解决refspec问题

我也有同样的问题。我删除了.git文件夹,然后执行以下命令

  • $git init
  • $git add.
  • $git远程添加源git@gitorious.org:project/project.git
  • $git提交-m“初始版本”
  • $git推送原始主机

  • 确保您在分支上,至少在主分支上

    类型:

    你应该看到:

    ubuntu用户:~/git/turmeric reling$git branch

    * (no branch)
    master
    
    然后键入:

    git checkout master
    

    然后,您的所有更改都将适用于主分支(或您选择的分支)

    我也遇到了同样的问题。我错误地用小写字母在机器中创建了目录。一旦改变了案例,问题就解决了(但浪费了我的1.5小时:()
    检查您的目录名和远程repo名称是否相同。

    我在创建我的第一个Git存储库时遇到了相同的问题。我在Git origin remote creation中输入了一个拼写错误-结果是我没有将存储库的名称大写

     git remote add origin git@github.com:Odd-engine
    
    首先,我使用

    git remote rm origin
    
    然后我重新创建了源代码,确保输入的源代码名称与我的源代码拼写完全相同

    git remote add origin git@github.com:Odd-Engine
    

    没有更多的错误!:)

    看起来这个问题已经有很多答案了,但我会考虑我的答案,因为我还没有看到任何解决我的问题的答案

    我在一个全新的github存储库中也遇到了这个错误。原来我推送的用户没有推送权限。出于某种原因,这会导致“ERROR:repository not found”错误,而不是某种访问错误


    无论如何,我希望这能帮助那些遇到同样问题的可怜的灵魂。

    我也有同样的问题。它解决了我的问题。 如果你在你的git里。你必须在终点站做什么

    1)
    git添加。

    2)
    git提交-m“首次提交”

    用于发送到bitbucket


    3)
    git push-u origin--all#第一次推高repo及其引用

    我刚刚遇到了这个问题,它似乎是由我的not在默认提交消息之上添加了一个自定义提交消息引起的(我想,为什么要写“初始提交”),当它在Git生成的文本中清楚地表示了相同的内容时)


    当我删除.git目录、重新初始化git的项目目录、重新添加GitHub remote、将所有文件添加到新阶段、在自动生成的消息上方提交个人消息并推送到origin/master时,问题得到了解决。

    在GitHub上创建存储库时,它向repo中添加了一个README.md文件,由于该文件可能不在本地目录中,或者可能有不同的内容,git push将失败。 为了解决这个问题,我做了:

    git pull origin master
    git push origin master
    

    这一次,由于我有README.md文件,所以它可以正常工作。

    在第一次提交之前,请尝试添加一些文件,如README.txt。这将“强制”远程回购在不存在的情况下创建分支主机。它是
    git config user.email "your email"
    git config user.name "name"
    
    git add .
    git commit -m "message"
    
    1. create a directory in Dropbox (or on your remote server)
    2. go to the Dropbox dir (remote server dir)
    3. type git command: git init --bare
    4. on your local drive create your local directory
    5. go to local directory
    6. type git command: git init
    7. add initial files, by typing git command:: git add <filename> 
    8. type git command: git commit -a -m "initial version" (if you don't commit you can't do the initial push
    9. type git command: git remote add name <path to Dropbox/remote server> 
    10. git push name brach (for first commit the branch should be master)