Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpine docker does not support git 2.35.2 #46

Closed
DennisPlaydon opened this issue Apr 21, 2022 · 8 comments
Closed

Alpine docker does not support git 2.35.2 #46

DennisPlaydon opened this issue Apr 21, 2022 · 8 comments

Comments

@DennisPlaydon
Copy link

Hi there,

We are pulling the latest alpine image and running git commands in CI. However we are running into a fatal: unsafe repository ('...' is owned by someone else). This seems to be a new error due to a security vulnerability in git.

The recommendation is to update to the latest version of git, version 2.35.2. Would it be possible to release a new version of alpine/git so it is possible to upgrade?

Thank you 😃

@ozbillwang
Copy link
Contributor

ozbillwang commented Apr 21, 2022

yes, I saw the same error on version 2.34.1 only. that's the latest image generated, which was auto-generated yesterday. No problem on tag 2.32.x

For production usage, please don't use the latest as tag when you pull the image, always stick on a version which have been tested.

Let me trigger the pipeline to build a new image on v2.35.2

@ozbillwang
Copy link
Contributor

ozbillwang commented Apr 21, 2022

Seems we have to wait for the new version available in Alpine. Let me explain.

This Dockerfile is to install git via apk add git directly, it will always install the latest version in Alpine.

But currently latest git version in alpine is v2.34.2

but the official git release has been v2.36.0 (https://github.com/git/git/tags)

I have to wait, otherwise, we need adjust our codes to compile and build the git from source codes, that would be totally different cases.

@ozbillwang
Copy link
Contributor

ozbillwang commented Apr 21, 2022

unless we switch the base image from alpine to alpine:edge

image

image

But alpine:edge is not for production

ref: https://wiki.alpinelinux.org/wiki/Edge#:~:text=From%20Alpine%20Linux,updated%20on%20a%20regular%20basis.

"edge" is the name given to the current development tree of Alpine Linux. It consists of a APK repository called "edge" and contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis.

Warning: "edge" is under constant development so be careful using it in production. It is possible that bugs in "edge" could cause data loss or could break your system.

@DennisPlaydon
Copy link
Author

Would it be possible to release a -preview version which uses alpine edge? We are not using the alpine/git in production. It is used for local and CI automation. Once alpine has updated then you could deprecate the preview version and switch back to standard alpine.

I will say that this is not a blocking issue. We have a workaround that trusts the directory which resolves the issue at the moment.

For anyone that stumbles upon this. We are using git config --global --add safe.directory /dir to trust the directory that is throwing errors.

I'm interested to know your thoughts on what should happen next

@jaydrogers
Copy link

Thanks for organizing and maintaining this project!

Just adding a note for others who are attempting to run git config --global --add safe.directory /git:

  • 👉 If you run this command before your git pull command in CI, then you may have to do an extra step

Solution:

  • Mount a volume for /root in the container

Example:
Here is a snippet from my Gitlab deployment:

script:
  - docker run --rm --pull always -v /home/deploy-user/:/root -v /path/to/my/app:/git alpine/git config --global --add safe.directory /git"
  - docker run --rm --pull always -v /home/deploy-user/:/root -v /path/to/my/app:/git alpine/git pull origin my-branch"

@DennisPlaydon
Copy link
Author

DennisPlaydon commented May 24, 2022

Hey @ozbillwang I see that alpine has released a new version. Could we update now?
image

@ozbillwang
Copy link
Contributor

the free pipeline sets some limitation build time now. i changed the build frequency from daily to weekly. so it is possible to wait for one week to get the latest version

@ozbillwang
Copy link
Contributor

The latest tag is v2.36.2 already.

Close this issu now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants