git push >> 致命:没有配置推送目的地
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10032964/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git push >> fatal: no configured push destination
提问by levelone
I'm still going through some guides on RoR and I'm stuck here at Deploying The Demo App
我仍在阅读有关 RoR 的一些指南,但仍停留在部署演示应用程序
I followed instructions:
我按照说明:
With the completion of the Microposts resource, now is a good time to push the repository up to GitHub:
$ git add . $ git commit -a -m "Done with the demo app" $ git push
随着 Microposts 资源的完成,现在是将存储库推送到 GitHub 的好时机:
$ git add . $ git commit -a -m "Done with the demo app" $ git push
What happened wrong here was the push part.. it outputted this:
这里发生的错误是推送部分..它输出了这个:
$ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>
git push <name>
So I tried following the instructions by doing this command:
所以我尝试通过执行以下命令来按照说明进行操作:
$ git remote add demo_app 'www.github.com/levelone/demo_app'
fatal: remote demo_app already exists.
So I push:
所以我推:
$ git push demo_app
fatal: 'www.github.com/levelone/demo_app' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
What can I do here? Any help would be much appreciated.
我能在这里做什么?任何帮助将非常感激。
采纳答案by Joachim Isaksson
The command (or the URL in it) to add the github repository as a remote isn't quite correct. If I understand your repository name correctly, it should be;
将 github 存储库添加为远程的命令(或其中的 URL)不太正确。如果我正确理解了您的存储库名称,则应该是;
git remote add demo_app '[email protected]:levelone/demo_app.git'
回答by VonC
You are referring to the section "2.3.5 Deploying the demo app" of this "Ruby on Rails Tutorial ":
您指的是“ Ruby on Rails 教程”的“ 2.3.5 部署演示应用程序”部分:
In section 2.3.1 Planning the application, note that they did:
$ git remote add origin [email protected]:<username>/demo_app.git
$ git push origin master
That is why a simple git push
worked (using here an ssh address).
Did you follow that step and made that first push?
这就是为什么一个简单的git push
工作(在这里使用一个 ssh 地址)。
您是否遵循了那一步并进行了第一次推动?
www.github.com/levelone/demo_app
wouldn't be a writable URI for pushing to a GitHub repo.
不会是推送到 GitHub 存储库的可写 URI。
https://[email protected]/levelone/demo_app.git
should be more appropriate.
Check what git remote -v returns, and if you need to replace the remote address, as described in GitHub help page, use git remote --set-url
.
应该更合适。
检查 git remote -v 返回什么,如果需要替换远程地址,如GitHub 帮助页面所述,使用git remote --set-url
.
git remote set-url origin https://[email protected]/levelone/demo_app.git
or
git remote set-url origin [email protected]:levelone/demo_app.git