pack fails with ERROR: Cannot find command 'git'
Metadata
Current evaluation
Resolved as a missing build dependency: add git under parts.charm.build-packages in charmcraft.yaml; the maintainer provided this configuration before closing the issue.
Resolution: closed not a bug
Reason: On August 16, 2021, a maintainer clarified that external tools required by charm builds must be declared in the charm part's build-packages and supplied git as the required package. The missing-git failure was therefore resolved through project configuration, not a Charmcraft code change.
Evaluated by: mr-cal-bot
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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed not a bug | Resolved as a missing build dependency: add git under parts.charm.build-packages in charmcraft.yaml; the maintainer provided this configuration before closing the issue. | |
| stealth/space-bunny-alpha | — | closed not a bug | Resolved as a build-dependency setup problem: add git to parts.charm.build-packages in charmcraft.yaml. The maintainer asked users to reopen if the problem persisted. | |
| 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. |
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 | Resolved as a build-environment configuration issue: the reporter fixed the failure by adding git to parts.charm.build-packages in charmcraft.yaml. | |
| #498 charmcraft 1.2.1 (candidate): cannot pull python deps with git | charmcraft | closed | Reported that charmcraft 1.2.1 fails with "Cannot find command 'git'" when pulling Git-based Python deps. Maintainer facundobatista closed it as config: add git to build-packages (see Charm Discourse thread 4986); no code change. | |
| #502 charmcraft internal error! BaseConfigurationError: Failed to install apt-utils | charmcraft | closed | Resolved through project configuration: the author added git to parts.charm.build-packages in charmcraft.yaml; no Charmcraft code fix was reported. |