如何在 Heroku 上安装 Git?

问题描述 投票:0回答:1

我需要 Heroku 中的网络应用程序安装

git
(我位于
heroku-24
堆栈上)。我正在尝试使用 heroku-community/apt。我使用以下内容创建了
Aptfile
(在 here 找到它):

https://launchpad.net/~git-core/+archive/ubuntu/ppa/+files/git-all_2.46.0-0ppa1~ubuntu20.04.1_all.deb

然后,我添加了构建包:

$ heroku buildpacks:add --index 1 heroku-community/apt
=== zerocracy Buildpack URLs

1. heroku-community/apt
2. heroku/ruby

在部署过程中,我看到这个日志:

remote: -----> Building on the Heroku-24 stack
remote: -----> Using buildpacks:
remote:        1. heroku-community/apt
remote:        2. heroku/ruby
remote: -----> Apt app detected
remote: -----> Detected Aptfile or Stack changes, flushing cache
remote: -----> Updating APT package index
remote:        Get:1 http://archive.ubuntu.com/ubuntu noble InRelease [256 kB]
remote:        Get:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
remote:        Get:3 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
remote:        Get:4 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages [1,808 kB]
remote:        Get:5 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
remote:        Get:6 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages [19.3 MB]
remote:        Get:7 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [594 kB]
remote:        Get:8 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [449 kB]
remote:        Get:9 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Packages [11.5 kB]
remote:        Get:10 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [337 kB]
remote:        Get:11 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [404 kB]
remote:        Get:12 https://apt.postgresql.org/pub/repos/apt noble-pgdg InRelease [129 kB]
remote:        Get:13 https://apt.postgresql.org/pub/repos/apt noble-pgdg/main amd64 Packages [476 kB]
remote:        rm: cannot remove '/var/cache/apt/archives/partial/*.deb': Permission denied
remote:        Fetched 24.2 MB in 2s (13.3 MB/s)
remote:        Reading package lists...
remote: -----> Fetching https://launchpad.net/~git-core/+archive/ubuntu/ppa/+files/git-all_2.46.0-0ppa1~ubuntu20.04.1_all.deb
remote: -----> Installing git-all_2.46.0-0ppa1~ubuntu20.04.1_all.deb
remote: -----> Writing profile script
remote: -----> Rewrite package-config files
remote: -----> Ruby app detected
...

但是,

git
不可用:

+ git --version
sh: 1: git: not found
linux git ubuntu heroku
1个回答
0
投票

我们无法在 Heroku 平台内安装 git。您只能通过 git 将应用程序部署到 Heroku。如果您确实需要在应用程序内安装 git,则必须尝试使用 AWS EC2 或 AWS Elastic Beanstalk 等基础设施服务。

© www.soinside.com 2019 - 2024. All rights reserved.