git致命错误路径与一个没有意义 [英] git fatal error Path with a does not make sense

查看:142
本文介绍了git致命错误路径与一个没有意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的电脑上有现有的代码,然后我在sourceforge注册了我的帐户,启动了一个git项目。现在我需要在sourceforge远程空间上发送我的本地项目。在sf上有说明页:

第一次使用Git

  cd miorep-code 
git init
git commit -a -m'初始提交'
git remote add origin ssh:// **** / p / miorep / code
git push origin master

现有版本库

  cd miorep-code 
git remote add origin ssh:// **** / p / miorep / code
git push origin master

如果我按照第一组指令操作, p>


致命:带-a的路径没有意义

当我得到 git commit -a -m'初始提交'



我得到的第二组指令:


错误:src refspec master与任何不匹配。
错误:无法将某些参考推送到'ssh:// * * / p / ravenna / code'


当我执行最后一个命令时。



在我的情况下,正确的指令集是什么?为什么我得到这个错误?

解决方案

第一组指令没有意义:

  cd miorep-code 
git init
git commit -a -m'初始提交'

git init 之间需要有一个 git add code>和 git commit ,否则 git 不知道 你想提交。你的第二个错误...

 错误:src refspec master与任何不匹配。错误:未能将一些文件推送到'ssh:// ** / p / ravenna / code'

...表示您还没有实际提交任何内容到您的本地存储库,因此没有 master 分支可以推送。



你想要做的是:

$ p $ cd $ mi $ p $ b $ git init
git add。
git commit -m'initial commit'
git push origin master

您注意这和你的第一组指令差不多一样,除了我们添加了一个 git add。这意味着添加所有内容我目前的目录和下面我的信息库。


I have existing code on my computer, then I have registerd my account on sourceforge, starting a git project. Now I need to send my local project on sourceforge remote space. On sf there's the instruction page:

First time using Git

cd miorep-code
git init
git commit -a -m 'Initial commit'
git remote add origin ssh://****/p/miorep/code
git push origin master

Existing Repository

cd miorep-code
git remote add origin ssh://****/p/miorep/code
git push origin master

If I follow the first set of instructions, I have a

"Fatal: Paths with -a does not make sense"

when I get git commit -a -m 'Initial commit'.

If I follow the second set of instruction I get:

error: src refspec master does not match any. error: failed to push some refs to 'ssh://**/p/ravenna/code'

when I exec the last command.

What's the correct set of instructions in my case? Why I get that error?

解决方案

The first set of instructions don't make sense:

cd miorep-code
git init
git commit -a -m 'Initial commit'

There needs to be a git add between git init and git commit, because otherwise git doesn't know what you want to commit. Your second error...

error: src refspec master does not match any. error: failed to push some refs to 'ssh://**/p/ravenna/code'

...means you haven't actually committed anything to your local repository yet, so there is no master branch to push.

What you want to do is:

cd miorep-code
git init
git add .
git commit -m 'initial commit'
git push origin master

You'll note that this is almost identical to your first set of instructions, except we've add a git add . which means "add everything in my current directory and below to my repository".

这篇关于git致命错误路径与一个没有意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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