As Ubuntu LTS-18.04 ships git-1.17.1 this is a frustrating limitation, as one needs to update git in virtually any docker container used, when you care about having .git folder present.
Checkout v2 was optimized to fetch a single commit - requires Git wire protocol v2.
Is the alternative to use raw git clone + git checkout commands if I want to use github actions on as vanilla Ubuntu LTS images as possible?
EDIT: We are testing git integration, so it's actually desirable to also use older versions. Does GitHub have any stats what versions of clients is used to access the site?
@phadej Can I ask how you are updating Git?
I'm using the circleci/ruby:2.4.1-node-browsers docker image, and I'm using the following commands:
sudo apt-get install python-software-properties software-properties-common
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version
But this fails:
Err http://http.us.debian.org jessie-backports/main Sources
404 Not Found [IP: 64.50.233.100 80]
I'm having to do this because actions/checkout fails on my build with the error (using Git 2.1.4):
##[error]EACCES: permission denied, open '/__w/ocs-website-rebuild/ocs-website-rebuild/577d8b45-e925-465b-9cc8-5831813609ad.tar.gz'
I'm assuming that if I can upgrade it to 2.18 then it can just do a normal git clone and not have to download a TGZ file (getting around the permissions issue). But my assumptions might be way off.
@stevehobbsdev PPA works only with Ubuntu, and jessie is Debian.
I currently use
- name: Checkout
run: |
git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git .
git fetch origin $GITHUB_REF:temporary-ci-branch
git checkout $GITHUB_SHA
step. It seems to work, but I'm quite sure I'm missing something.
I'm experiencing this issue too.
Checkout v2 was optimized to fetch a single commit - requires Git wire protocol v2.
@ericsciple The benefit of fetching a single commit clone is lost when using the ubuntu-latest image, which is widely used. Instead of a file sync when the git version is < 2.18, it would be convenient if the plugin performed a shallow clone of a single branch. This is supported in 2.11 with the --depth 1 and --branch options
@tariqc80 ubuntu-latest has git version 2.26.0
Here is my workflow:
on: push
jobs:
build:
runs-on: [ubuntu-latest]
steps:
- run: git --version
Using branch + depth 1 is a race condition. The ref may move forward before the job begins, especially in workflows with a graph of jobs.
...which is why checkout@v2 fetches the SHA instead
@ericsciple Thanks for the response. I didn't realize that the job I was working with was using a container built from Debian Stretch; which ships with git v2.11.
Now I understand the difference between runs-on and container. Updating the git version in the container got me working correctly.