How do I install libgit2 on Alipne linux

2019-09-10 15:32发布

问题:

I am new to Docker and trying to use an Alpine docker image for my project. I am getting the following error when I am try to build the project.

gopkg.in/libgit2/git2go.v22
# pkg-config --cflags libgit2
pkg-config: exec: "pkg-config": executable file not found in $PATH

I think I need to install libgit2 but I am not able to:

bash-4.3# apk add libgit2
ERROR: unsatisfiable constraints:
  libgit2 (missing):
    required by: world[libgit2]

Thanks for any help.

-dj

回答1:

libgit2 is not present in either of main or community repositories that come preconfigured in the standard Alpine image, so you'll have to add the testing repo first:

# echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories

Then update package caches:

# apk update

And finally install libgit2:

# apk add libgit2



回答2:

As of the start 2017 libgit2 has been added to the main repository. You should be able to install now with the usual

apk update
apk add libgit2

https://pkgs.alpinelinux.org/packages?name=libgit2



标签: docker alpine