你如何从nitrous.io推向GIT

时间:2013-09-18 10:30:01

标签: ruby-on-rails git heroku github nitrousio

我正在关注本指南Nitrous to Heroku Guide

它描述了分叉git repo的过程,但我想将我的目录推送到Git然后再推送到Heroku。好吧,我真的很想把我的东西推给Heroku。阿格现在我迷路了。

所以要么直接推送到Heroku,要么直接推送到Git,然后推送到Heroku。

如果我错过了某些内容,请随时欢迎使用教程链接。

提前致谢。 :)

2 个答案:

答案 0 :(得分:14)

您需要在同一个项目中添加两个遥控器。

为Git启动您的项目

$ git init

要将Github远程添加到项目中并按下:

$ git remote add origin https://github.com/user/repo.git
# Set a new remote

$ git remote -v
# Verify new remote
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)

$ git add .
$ git commit -m "initial commit"
$ git push origin master

创建一个新的Heroku项目并将遥控器推送到您的项目:

$ heroku create

$ git remote -v
# Verify new remote (you will see heroku and origin now
# heroku     git@heroku.com:falling-wind-1624.git (fetch)
# heroku     git@heroku.com:falling-wind-1624.git (push)
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)

$ git push heroku master

这是一个标准策略,您每次都想要添加,提交,然后推送到origin master(Github)和heroku master(Heroku)。

答案 1 :(得分:2)

如果您的Nitrous Box上有本地数据,这还不是git repo,您​​需要做的是:

cd /path/to/stuff
git init
git add .
git commit -m "Make stuff into a git repo"

从那里开始,您可以按照tutorial you mention in your question中描述的步骤进行操作,但步骤7除外:您不需要克隆回购,因为您刚刚创建了回购。