pack fails with ERROR: Cannot find command 'git'
Metadata
Current evaluation
Resolved by adding parts: charm: build-packages: [git] to charmcraft.yaml to install required dependencies. The issue was closed after confirming this configuration addresses the missing git error on fresh installs.
Suggested action: —
No scores available.
Issue body
I installed charmcraft 1.2.0 on a new system, and `charmcraft pack` fails with "Cannot find command 'git'" (see attach).
I then `snap refresh` to stable, and pack works. Then `snap refresh` back to candidate, and pack suddenly works.
In other words, when refreshing from a previous version, pack works; when installing a fresh 1.2.0, pack fails.
[charmcraft-no-git.log](https://github.com/canonical/charmcraft/files/6957566/charmcraft-no-git.log)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved by adding parts: charm: build-packages: [git] to charmcraft.yaml to install required dependencies. The issue was closed after confirming this configuration addresses the missing git error on fresh installs. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved by documenting that users must explicitly list required build tools like git in charmcraft.yaml under parts: charm: build-packages. The issue was closed after confirming this configuration resolves the missing dependency error. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as resolved. The fresh-install git dependency error was addressed via a configuration workaround requiring users to explicitly list git in the charmcraft.yaml build-packages section. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed by documenting that git must be explicitly listed in charmcraft.yaml under parts: charm: build-packages. The issue was closed after confirming this configuration resolves the fresh install failure. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved by adding build-packages: [git] under the parts section in charmcraft.yaml. Explicitly declaring the git dependency prevents fresh install failures. Issue closed. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #605 Charmcraft fails to build due to lack of Git | charmcraft | closed | Charmcraft fails to build when installing git-referenced dependencies due to a missing git binary in the build environment. The reporter resolved the issue by adding git to build-packages in charmcraft.yaml. Closed as resolved. | |
| #502 charmcraft internal error! BaseConfigurationError: Failed to install apt-utils | charmcraft | closed | Resolved by adding missing build dependencies to charmcraft.yaml. The author confirmed that specifying parts.build-packages, such as git, fixed the LXC container setup failures for apt-utils and git during charmcraft pack. |