2012-02-22 62 views
6

我們使用gitolite來管理我們的倉庫,我們的一個heroku項目有git子模塊。有沒有辦法讓Heroku的公鑰驗證?heroku + git submodule需要認證

謝謝大衛

+1

會不會使用Heroku的任何人都將能夠實現自己的子模塊?此外,值得檢查Heroku是否在塞​​子編譯期間提供公鑰/私鑰。 – kanzure 2012-04-11 16:59:57

回答

10

不,可能不是。相反,當您在git存儲庫中創建子模塊時,您可以使用HTTPS基本身份驗證,即similar to deploying private gems to Heroku。看起來是這樣的:與github上註冊,與您的帳戶或專用部署帳戶

git submodule add https://username:[email protected]/username/repo.git 
+2

github已經爲此推出了一項新功能:https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth – kanzure 2012-09-25 22:43:22

+0

我今天試過,得到了這個: '致命的:我不處理協議'git clone https'' – 2013-01-17 02:05:22

+0

你輸入了什麼? – kanzure 2013-02-08 05:43:07

3

您也可以提交包含一個專用的id_rsa鑰匙(「部署鍵」)一個.ssh目錄。不要忘了chmod 0660的關鍵。

+2

.ssh文件夾應該放在哪裏? – acjay 2013-04-08 21:40:37

+1

是的,這是如何工作? – 2013-04-11 22:54:07

+1

現在有更好的解決方案使用buildpack: https://github.com/timshadel/heroku-buildpack-github-netrc – 2014-04-06 13:53:22

1

還有另一種解決辦法@kanzure:https://stackoverflow.com/a/29464430/990356

轉到Settings > Personal access tokens並生成啓用repo範圍的個人訪問令牌。

現在你可以做git clone https://[email protected]/user-or-org/repo和子模塊git submodule add https://[email protected]/user-or-org/repo

優點的情況下:

  • 非常簡單的方法
  • 令牌可以很容易地撤銷
  • 真實的密碼是安全的

缺點:

  • 如果有人訪問令牌,他就可以訪問你的GitHub的回購協議(讀寫)