简体   繁体   English

git 推送 >> 致命:未配置推送目标

[英]git push >> fatal: no configured push destination

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:随着微博资源的完成,现在是将仓库推送到 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.任何帮助将非常感激。

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:2.3.1 Planning the application部分,请注意他们做了:

$ git remote add origin git@github.com:<username>/demo_app.git
$ git push -u origin master

That is why a simple git push worked (using here an ssh address).这就是为什么简单的git push有效(这里使用 ssh 地址)。
Did you follow that step and made that first push?您是否按照该步骤进行了第一次推动?

 www.github.com/levelone/demo_app

That would not be a writable URI for pushing to a GitHub repo.这不是用于推送到 GitHub 存储库的可写 URI。

https://levelone@github.com/levelone/demo_app.git

This 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://levelone@github.com/levelone/demo_app.git
# or 
git remote set-url origin git@github.com:levelone/demo_app.git

The command (or the URL in it) to add the github repository as a remote isn't quite correct.将 github 存储库添加为远程的命令(或其中的 URL)不太正确。 If I understand your repository name correctly, it should be;如果我正确理解您的存储库名称,它应该是;

git remote add demo_app 'git@github.com:levelone/demo_app.git'

I have faced this error, Previous I had push in root directory, and now I have push another directory, so I could be remove this error and run below commands.我遇到过这个错误,之前我已经推送到根目录,现在我推送了另一个目录,所以我可以删除这个错误并运行下面的命令。

git add .
git commit -m "some comments"
git push --set-upstream origin master

I already have faced this error.我已经遇到过这个错误。 I create a github repository and I copy repository Url and I run following command.我创建一个 github 存储库并复制存储库 Url 并运行以下命令。

git remote add service-center-app 'https://github.com/DeveloperAsela/service-centerapp.git'

This happened to me when I was using Visual Studio Code with Github. I have realized that the upstream branch was empty for some reason and push did not know where to push.当我在 Github 中使用 Visual Studio Code 时,这发生在我身上。我意识到上游分支由于某种原因是空的,push 不知道要推到哪里。 Using "sync" fixed the problem.使用“同步”解决了这个问题。

I had the same problem我有同样的问题

using vs code if you click on the menu button go down to push,pull then scroll down to push to and使用 vs code 如果你点击菜单按钮 go 向下推,拉然后向下滚动推到和

When pushing for the first time.第一次推的时候。 You should use你应该使用

git push -u origin master git push -u 起源大师

Here is how I resolve the same issue:以下是我如何解决同样的问题:

  1. create repository创建存储库

  2. git branch -M main git支线-M主线

  3. git push -u origin main git push -u origin main

If you are using git commands using cmd如果您使用 git 命令使用 cmd

git remote add origin git@github.com:<username>/demo_app.git

You can copy it from your repo https code you are currently working on.您可以从当前正在处理的代码库 https 中复制它。

After this run运行后

git push

This worked for me.这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM