2016-05-31 43 views
0

我目前正在做一个rails项目,它初始化,添加,提交并推送一个heroku应用程序中的临时文件夹。我有一个工作人员使用波浪号语法git init,git add .等,但它不会允许我推动任何东西,除非我登录,这是我不能做的,因为这是一个自动化过程。如何在heroku工人dyno上登录git?

在开发过程中,当我提示时我只是使用凭据登录,它保存了我的凭据,但我似乎无法弄清楚如何在生产环境中执行此操作(特别是heroku)。

如何在Heroku中做到这一点? 谢谢!

该错误消息我得到

*** Please tell me who you are. 
2016-05-31T00:14:48.579213+00:00 app[worker.1]: 
2016-05-31T00:14:48.579214+00:00 app[worker.1]: Run 
2016-05-31T00:14:48.579235+00:00 app[worker.1]: 
2016-05-31T00:14:48.579236+00:00 app[worker.1]: git config --global user.email "[email protected]" 
2016-05-31T00:14:48.579237+00:00 app[worker.1]: git config --global user.name "Your Name" 
2016-05-31T00:14:48.579237+00:00 app[worker.1]: 
2016-05-31T00:14:48.579238+00:00 app[worker.1]: to set your account's default identity. 
2016-05-31T00:14:48.579238+00:00 app[worker.1]: Omit --global to set the identity only in this repository. 
2016-05-31T00:14:48.579239+00:00 app[worker.1]: 
2016-05-31T00:14:48.579244+00:00 app[worker.1]: fatal: empty ident name (for <omitted.(none)>) not allowed 
2016-05-31T00:14:48.627233+00:00 app[worker.1]: Host key verification failed. 
2016-05-31T00:14:48.627836+00:00 app[worker.1]: fatal: Could not read from remote repository. 
2016-05-31T00:14:48.627842+00:00 app[worker.1]: 
2016-05-31T00:14:48.627843+00:00 app[worker.1]: Please make sure you have the correct access rights 

回答

0

假设你正在使用的GitHub以及Git,那么将需要生成的令牌为您的帐户。

Creating an access token for command-line use

一旦你的道理,你可以使用令牌代替密码。令牌相当于一个密码,因此您需要采取适当的预防措施。我建议在Heroku环境中存储令牌。

现在,您将克隆使用用户名和令牌,回购像这样:

git clone https://<MYUSERNAME>:<MYTOKEN>@github.com/rails/rails.git

您现在应该能够git push回到GitHub上。

+0

对不起,延迟回复。如果我正在进行初始化和推动而不克隆呢?我的heroku应用程序用一堆文件创建一个文件夹,初始化新文件夹,添加所有内容,提交并将其推送到我之前创建的存储库。 –

+0

我用超时选项找到了'git config --global credential.helper cache'。有没有办法让无限?这会被转移到同一个应用程序的其他heroku dynos吗? –

相关问题