我正在遵循这个指南: Nitrous to Heroku Guide 它描述了一个分叉 git repo 的过程,但我想把我的一些东西推到 Git 上然后推到 Heroku。实际上我真的只想将我的东西直接push到Heroku上。啊,现在我迷失了。 所以要么直接推到Heroku上,要么推到Git然后再推到Heroku上。如果我忽略了什么,请随时提供教程链接。 提前致谢。 :)
你需要在同一个项目中添加两个远程仓库。
为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 项目并将远程推送到您的项目中:
To create a new Heroku project and push the remote to your project:
$ 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
这是一个标准策略,您每次都需要执行 git add、commit,然后将其推送到 origin master
(Github)和 heroku master
(Heroku)。
如果您在Nitrous Box上有本地数据但尚未成为git repo,则需要执行以下操作:
cd /path/to/stuff
git init
git add .
git commit -m "Make stuff into a git repo"
从那里开始,您可以按照您的问题中提到的教程所描述的步骤进行操作,但第7步除外:您不需要克隆repo,因为您刚刚创建了一个。