由git push -u origin master产生的2个错误 [英] 2 errors produced by git push -u origin master

查看:420
本文介绍了由git push -u origin master产生的2个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在提出这个问题之前,我浏览了4个类似的线程,这些线程还没有回答我的问题,所以我现在发布。



我正在做一个通过One Month Rails项目,直到我执行以下操作时,都设置了Git和GitHub,没有任何问题:

  $ git push -u origin master 

然后我得到了这个输出(最初):

fatal:没有指定路径。请参阅man git-pull获取有效的url语法。

基于另一个SO线程,我尝试了这两个命令:

  $ git remote rm origin 
$ git remote add origin'git@github.com:rubymal / pinteresting.git'

我再次尝试过:

  $ git push -u origin master 

输出:

< pre class =lang-none prettyprint-override> 错误:src refspec master与任何不匹配。
错误:未能将某些参考文献推送到'git@github.com:rubymal / pinteresting.git'

可能是什么问题?

解决方案

您应该至少在您的工作目录中有一个提交文件,然后再推送在Github上提交。
$ b $ < git add 命令将工作目录中的更改添加到暂存区域。它告诉Git你希望在下一次提交中包含对特定文件的更新。

  $ git add。 

接下来, git commit 命令提交分阶段快照到项目历史。

  $ git commit -m'第一次提交'

注意:在推送到git存储库之前,您必须提交分阶段文件。您的问题与此特定步骤有关。

最后, git push 是您如何从本地存储库传输提交到一个远程仓库。

  $ git push origin master 


Before this is questioned, I've browsed 4 similar threads that have not answered my question yet, so I'm posting now.

I'm doing a project through One Month Rails, have set up Git and GitHub without any problem until I go to do the following:

$ git push -u origin master

Then I got this output (originally):

fatal : No path specified. See man git-pull for valid url syntax.

Based on another SO thread, I tried these two commands:

$ git remote rm origin
$ git remote add origin 'git@github.com:rubymal/pinteresting.git'

I tried again:

$ git push -u origin master

Output:

error: src refspec master does not match any.
error: failed to push some refs to 'git@github.com:rubymal/pinteresting.git'

What could be the problem?

解决方案

You should at least have one committed file in your working directory before pushing a commit on Github.

The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.

$ git add .

Next, the git commit command commits the staged snapshot to the project history.

$ git commit -m 'First Commit'

NOTE: You must commit the staged files before pushing to the git repository. Your problem is associated with this particular step.

Finally, git push is how you transfer commits from your local repository to a remote repository.

$ git push origin master

这篇关于由git push -u origin master产生的2个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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