Putting git inside a snap

Marco Ceppi marco.ceppi at canonical.com
Tue Aug 16 22:08:04 UTC 2016

Hello, I've spent the better part of my day hitting my head too hard
against a wall. Figured I'd ask the list for more assistance.

tl;dr: git doesn't work when included inside my snap and it's really
messing me up.

snap install charm --edge

I'm snapping charm and charm-tools as a single snap. One is a godeps "part
type" and the other python. Getting these two working together in a single
snap was pretty straight forward. The charm command works as expected and
finds the charm-tools plugins bundled alongside the snap it the proper path.


My problem is some of the charm-tools commands rely on git, bzr, or hg to
perform their commands. When trying the most basic step command

`charm create foo`

Which will checkout the python-reactive boilerplate template from github
and place it in the users current working directory the following errors
pop up in the output:

warning: templates not found /usr/share/git-core/templates
fatal: Unable to find remote helper for 'https'

During this run, there's nothing from apparmor complaining about bits and
the snap is in strict confinement. Even in devmode the error persists.

The second error seems to be the core of the problem, based on this
http://stackoverflow.com/q/8329485/196832 it seems that git has been
compiled without ssl support. I find this hard to believe since it's being
pulled from the archive and it works pretty well on my Xenial machine.

After consulting some in IRC the suggestion seems to be that I need to
compile git from source in my snapcraft parts. After a few hours of trying
to get the following part to compile I've all but given up.

    plugin: autotools
    source: https://github.com/git/git.git
    source-type: git
    source-tag: v2.9.3
    install-via: prefix
      - libcurl4-gnutls-dev
      - libexpat1-dev
      - gettext
      - zlib1g-dev
      - libssl-dev
      - libc6-dev

Has anyone included git as a part of their snap?
Is there a different way to interface with git?
How can I troubleshoot this further?

We're (over)due for a release of charm and charm-tools and I'd honestly
prefer snap distribution over deb packages but compiling git from upstream
just to get it working seems like a step in the wrong direction.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160816/22158062/attachment.html>

More information about the Snapcraft mailing list