将heroku应用程序链接到私有(组织)github存储库 [英] Linking heroku app to a private(organization) github repo

查看:87
本文介绍了将heroku应用程序链接到私有(组织)github存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在本地工作,将更改推送到Heroku即可正常运行,并且该应用程序按预期运行.但是我在将heroku应用程序链接到Github上的私人仓库时遇到了麻烦.

Working on local, pushing changes to Heroku works and the app works as expected. However I am having trouble linking heroku app to a private repo on Github.

当前配置如下所示

git@github.com:{Organization}/{project}.git

我应该在哪里为私人仓库配置用户名/密码?

Where should I configure username/password for the private repo?

我尝试过(即使这不是首选方式)

I tried (even though this is not the preferred way)

username:password@github.com/{organization}/{project}.git

对此有任何建议,我们将不胜感激.

would appreciate any pointers regarding this.

我没提到我是在Heroku的应用程序设置下设置它的.

I failed to mention that I am setting it under app settings in Heroku.

推荐答案

 git@github.com:{Organization}/{project}.git

这是一个ssh地址,其身份验证由公钥/私钥管理:确保您的公钥已在该组织的协作者密钥中发布.
没有用户名"或密码"在这里.

This is an ssh address, with the authentication managed by public/private key: make sure your public key is published among the collaborators' keys for that Organization.
No "username" or "password" here.

username:password@github.com/{organization}/{project}.git

如果使用该远程地址作为 HTTPS 地址,那可能是正确的.

That could be correct if you use that remote address as an HTTPS address.

请注意, Honza Javorek 在"

Note that Honza Javorek mentions in "How do I access a private github repo from heroku?" in Nov. 2020:

Heroku仅支持开箱即用Git的HTTP(S)基本身份验证.
不幸的是,这意味着您需要将凭据添加为安装URL的一部分,并将其作为纯文本提交到依赖项列表中.

Heroku only supports HTTP(S) Basic authentication with Git out of the box.
That's unfortunate as it means you'd need to add your credentials as part of the installation URL and commit that as plain text in your list of dependencies.

他建议

He suggests to create a new GitHub SSH key and follow the heroku-buildpack-ssh-key process:

heroku buildpacks:add https://github.com/heroku/heroku-buildpack-ssh-key.git -i 1
heroku config:set BUILDPACK_SSH_KEY=$(cat ~/.ssh/id_rsa_heroku)

这篇关于将heroku应用程序链接到私有(组织)github存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆