I need my web app in Heroku to have git
installed (I'm on the heroku-24
stack). I'm trying to use heroku-community/apt. I created Aptfile
with the following content (found it here):
https://launchpad.net/~git-core/+archive/ubuntu/ppa/+files/git-all_2.46.0-0ppa1~ubuntu20.04.1_all.deb
Then, I added the buildpack:
$ heroku buildpacks:add --index 1 heroku-community/apt
=== zerocracy Buildpack URLs
1. heroku-community/apt
2. heroku/ruby
During the deployment, I see this log:
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
...
However, git
is not available:
+ git --version
sh: 1: git: not found
Instead of using a specific .deb file, try installing git using the apt package manager. Update ur Aptfile to:
git
or
git-all
This will install the git package from the (probably Ubuntu) repositories.
Then, try to redeploy your app to Heroku. Git should be available for u after the deployment.
Note: Make sure you have heroku-community/apt buildpack installed and configured.
If that didn't help:
Try updating everythink. Try using different packages.
Also note that: You probably shouldn't use git in heroku anyway.