Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Heroku部署,未添加git remote_Node.js_Git_Heroku - Fatal编程技术网

Node.js Heroku部署,未添加git remote

Node.js Heroku部署,未添加git remote,node.js,git,heroku,Node.js,Git,Heroku,我是新来Heroku的,试图学习“NodeJS入门教程”,但我被困在了“”阶段 当我运行“heroku创建”时,我没有得到“Git remote heroku added”。在尝试“git-push-heroku-master”步骤并获得“致命:不是git存储库(或任何父目录):.git”后,我意识到它丢失了。我做错了什么?请执行以下命令,然后输入: git init 之后,您可以再次git推送heroku master您可以进入应用程序的根目录并运行以下命令: heroku git:remo

我是新来Heroku的,试图学习“NodeJS入门教程”,但我被困在了“”阶段


当我运行“heroku创建”时,我没有得到“Git remote heroku added”。在尝试“git-push-heroku-master”步骤并获得“致命:不是git存储库(或任何父目录):.git”后,我意识到它丢失了。我做错了什么?

请执行以下命令,然后输入:

git init

之后,您可以再次
git推送heroku master

您可以进入应用程序的根目录并运行以下命令:

heroku git:remote -a 'app-name e.g radiant-garden-35190'
之后,运行以下命令查看与应用程序关联的所有远程设备:

git remote -v
你应该得到这样的回答:

heroku  https://git.heroku.com/radiant-garden-35190.git (fetch)
heroku  https://git.heroku.com/radiant-garden-35190.git (push)

如果您尚未提交应用程序,则可能无法看到github的遥控器

如果要添加自定义远程名称:

heroku git:remote --app my-heroku-app-name -r my-custom-remote-name

从@tien nguyen扩展答案。运行以下操作后,应初始化空git存储库:

git init
如果立即运行此操作:

git push heroku master
它将返回以下内容:

error: src refspec master does not match any.
error: failed to push some refs to 'heroku'
这很可能是因为没有任何东西被推送。添加文件、提交并再次尝试推送应该可以解决此问题

git add .
git commit -m "initial commit"
git push heroku master
这应该提交并将文件推送到repo中

在git remote尚未定义的情况下。使用以下命令:

heroku git:remote -a <name of the heroku app>
git remote -v
heroku git:remote-a git远程-v 这应该列出远程url,应该如下所示:

heroku  https://git.heroku.com/<name of the heroku app>.git (fetch)
heroku  https://git.heroku.com/<name of the heroku app>.git (push)
herokuhttps://git.heroku.com/.git (取回) 赫罗库https://git.heroku.com/.git (推) 现在继续添加、提交并再次推送


希望有帮助

运行heroku create my Azing app后,您应该会看到一个带有web url和git url的响应。使用git url(类似git.heroku…/my Azing app.git)自己添加遥控器,如下所示:

git-remote-add-heroku-git.heroku…/my-mazing-app.git

然后运行
git remote-v
应该会显示带有heroku的新远程设备

'heroku git:remote --app $appname'

如果在“heroku创建”时未添加此命令,则此命令可以添加到git remote。

确保您需要在项目文件夹下运行此命令
heroku git:remote-a project_name

谢谢,我尝试过,在“git push heroku master”之后,我收到一条关于权限问题的消息,如下:“权限被拒绝(公钥).fatal:无法从远程存储库读取。请确保您具有正确的访问权限,并且存储库存在。“我该怎么办?我成功了!”!基本上,我用以下命令创建了一个键:“heroku-keys:add”。然后“在~/.ssh/id_rsa.pub上找不到现有的公钥。您想生成一个吗?[Yn]y生成新的ssh公钥。”之后,我再次尝试了“git push heroku master”,它成功了!标记为已接受,很遗憾,我没有必要的代表向您投票抱歉。我在win10上遇到了相同的问题,运行“git init”再次解决了我的问题。对问题和答案进行表决。谢谢。这是很有帮助的,尤其是我在同一git repo中添加了第二个heroku remote