Git push origin master返回“fatal:No path specified。”。 [英] Git push origin master returns "fatal: No path specified."
问题描述
mkdir sample_app
cd sample_app
git init
touch README
git add README
git commit -m'first commit'
git remote add origin git@github.com:rosdabos55 / sample_app.git
git push原始大师
我一路走到最后一条指令(git push origin master),没有任何问题。但是,当我将最后一行输入到终端时,我收到了以下错误消息:致命的:未指定路径。请参阅'man git-pull'以获取有效的url语法。我可能会做错什么?
以下是.git / config的内容(由Jefromi从 git config -l
粘贴到下面的评论中):
[用户]
名称= Ross
email = [删除]
[核心]
编辑器= gvim -f
repositoryformatversion = 0
filemode = true
裸=假
logallrefrefddates = true
[remoteorigin]
url = git@github.com:
fetch = + refs / heads / *:refs / remotes / origin / *
我已经在评论中声明了另一个答案,但它确实是答案我已经将注释的相应部分编辑到了它所属的问题中)。
无论出于何种原因,远程URL都没有正确配置。它被设置为git@github.com:,这显然缺少了路径,产生了你所看到的错误。您需要正确重新配置它。您可以简单地编辑 .git / config
,更改适当的行以包含路径。或者你可以这样做:
git remote rm origin
git remote add origin'git@github.com:rosdabos55 /sample_app.git'
当您添加遥控器时,您几乎可以肯定地犯了一些小错误或粗心的错误第一次 - 也许你在它的中间点击进入,也许你在冒号后键入一个空格。 (出于某种原因,当你在 remote add< name>< url>
之后提供额外参数时,git似乎不会引发错误 - 它只是忽略它。)结果是,您并未真正运行该命令,并且您添加了带有不完整URL的远程设备。
I recently set up a new account with github. I'm following a Rails tutorial from Michael Hartl online ( http://www.railstutorial.org/book#fig:github_first_page ) and followed his instructions to set up my git which were also inline with the setup instructions at github. Anyways, the "Next Steps" section on github were:
mkdir sample_app
cd sample_app
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:rosdabos55/sample_app.git
git push origin master
I got all the way to the last instruction (git push origin master) without any problem. When I entered that last line into my terminal, however, I got this error message: "fatal: No path specified. See 'man git-pull' for valid url syntax." What might I be doing wrong?
Here are the contents of .git/config (reconstructed by Jefromi from the output of git config -l
pasted into a comment below):
[user]
name = Ross
email = [REDACTED]
[core]
editor = gvim -f
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:
fetch = +refs/heads/*:refs/remotes/origin/*
I've stated this in the comments to another answer, but it's really the answer (and I've edited the appropriate section of the comments into the question where it belongs).
The URL for the remote was not configured correctly, for whatever reason. It's set to "git@github.com:", which is clearly missing the path, producing precisely the error you see. You need to reconfigure it correctly. You could simply edit .git/config
, changing the appropriate line to contain the path. Or you could do this:
git remote rm origin
git remote add origin 'git@github.com:rosdabos55/sample_app.git'
You almost certainly made some small typo or careless mistake when you added the remote the first time - perhaps you hit enter in the middle of it, perhaps you typed a space after the colon. (For some reason, git does not appear to throw an error when you provide an extra argument after remote add <name> <url>
- it just ignores it.) The upshot is that you didn't actually run that command, and you added a remote with an incomplete URL.
这篇关于Git push origin master返回“fatal:No path specified。”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!