【问题标题】:How to attach my repo to heroku app如何将我的 repo 附加到 heroku 应用程序
【发布时间】:2011-10-16 05:09:34
【问题描述】:

我创建了一个 heroku 应用程序,然后我的机器崩溃了。我有一台新机器。如何将我现有的应用程序附加到 heroku 应用程序。当我访问 heroku 页面时,我的应用程序的 url 是这样的

git@heroku.com:myapp.git

我不能克隆这个应用程序,因为我已经从 github 获得了myapp。所以我需要将 heroku 作为远程添加到我现有的 github 应用程序中。任何人都知道语法。

【问题讨论】:

标签: heroku


【解决方案1】:

如果你有 heroku 工具带:

如果您使用 Heroku Toolbelt,则较新的语法是

heroku git:remote -a project

请参阅this 了解更多信息。

致谢:user101289 的解决方案

否则,如果您没有 heroku 工具带:

首先这样做:

git remote add heroku git@heroku.com:{heroku-app-name}.git

然后这样做:

git push heroku master
heroku open

【讨论】:

  • 我有一个免费的 Heroku 帐户,似乎必须用这个交换 git@...:git.heroku.com{app}.git
  • 对我来说 'git remote add https://git.heroku.com / {heroku-app-name}.git' 似乎有效。
【解决方案2】:

如果您使用 Heroku Toolbelt,则较新的语法是

heroku git:remote -a project

请参阅this 了解更多信息。

【讨论】:

    【解决方案3】:

    如果您只使用Git 而不安装Heroku Toolbelt,您也可以创建一个新应用程序。

    登录您的帐户并转到此链接

    https://dashboard.heroku.com/apps

    查看右上角的加号,然后选择

    创建新应用

    将应用程序名称留空,让 heroku 为您选择一个。 假设您的 Heroku 应用名称是 new-app-xxxxx,因此要测试向其中添加文件,您可以尝试以下命令:

    git clone https://git.heroku.com/<new-app-xxxxx>.git
    cd <new-app-xxxxx>
    echo "my test file" > test.txt
    git add .
    git commit . -m "my test on commit" 
    git push
    

    当 Git 提示输入用户名时输入空(空白),密码输入 API 密钥。您可以从下面的链接中显示您的 API 密钥。

    https://dashboard.heroku.com/account

    注意:您无法使用您的 Heroku 用户名(电子邮件)和密码向 Heroku HTTP Git 端点进行身份验证。使用描述的 API 密钥 here

    【讨论】:

      猜你喜欢
      • 2012-07-26
      • 2017-05-16
      • 2013-09-22
      • 2012-10-15
      • 2016-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-13
      相关资源
      最近更新 更多