-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
no .git folder #335
Comments
If you are running on a self-hosted runner, is your CI checking out your project using git or github REST API ? |
I was using
This means, the repository got downloaded using the GitHub REST API, which meant to dowloaded differently. So for debugging what's going around, I tried on the
After comparing those two logs: one is using Git version: Hence, after updating the Git version (>= 2.18) into latest one, the issue got resolved in my case. |
I'm using GitHub itself and not a self hosted runner but keep running into the same issue. We use the .git folder during our scripts. |
same issue :( |
As @RaiBnod already mentioned, upgrading git did the trick for me, too (in my case |
Also seeing lack of .git folder, git reports Why is this version-specific, hasn't EDIT: Hmm, another version of git is active somehow somewhere? Thanks for the clues about what to investigate...
Is this referring to the copy of Tried
Is the root cause a TLS thing? EDIT AGAIN: Apparently what I needed to do was delete this from the workflow file, because then it ... uses something newer? I have no idea: container:
image: ubuntu:latest I assume that's a restatement of what's already been said above. Included for anyone else who's as clueless as I am. |
Self hosted: upgrading git for debian-based distros: sudo apt-get install -y software-properties-common \
&& sudo apt-get update \
&& sudo add-apt-repository -y ppa:git-core/ppa \
&& sudo apt-get update \
&& sudo apt-get install -y git Either run it before the |
This was also an issue for me (due to use of setuptools_scm on a project I am running in a container) and it took me a good while to find this issue. I think this difference in behavior should be more prevalent in the README. |
Any ideas on getting the self-hosted up to a later version? I have the same issue but the older version of git is limiting other features we want. I need at least 2.18 or higher. |
2021-04-01: I still see the same problem when running on GitHub itself. |
Even after running those ^ on a self-hosted docker image I still get the same errors. For some reason I only get a 2.7 version of GIT installed and nothing newer. Cannot seem to get past it. |
UPDATE: Got it working - rather than running git install on Dockerfile, just run it before the checkout phase like suggested above. Here's how mine looks:
Works on Ubuntu:18.04. Cheers 👍🏼 |
I still see the failure when using git 2.20.1 Besides, updating is just a workaround: the bug should be fixed in order to support older git versions. |
@amagana3 The problem is you are modifying the "base os" of the runner with that. Here is my solution to this bug, until it is fixed upstream -- "pipe" the
Key parts:
vs
This is actually a pretty elegant solution to this problem imo. |
Here is a much smaller and quicker version via alpine:
Again, noting that |
@ventz Thanks for this! However, using Explicit error:
|
@mrowles Alpine doesn't have bash by default - it uses If you need bash, you can just add it as a package to the pre-checkout line. With that said, I suspect you may have something else going on within your action config, because in this case the 'container: alpine:latest' is only used for the checkout action, and the "run" before it is to populate the alpine container. (ex: if we were using another image that had git, or for example ubuntu -- we would not need that step). So, I am assuming you are adding additional steps which are not wrapping other actions, and thus not executed with the container? (ex: directly with the run command?). |
@ventz Got it! So I'll need to install bash, aws etc. if I was to use anything not provided. No dramas, thanks for the help! For future people, my main problem is not so much the |
@mrowles Yes. My suggestion is to keep it all wrapped into nice clean containers that you own, and then just call them either directly, or with custom actions. It makes the actions yaml config very clean, fast, and efficient. (Especially if you are not installing things you won't need at each run. Again, the git example above is not this on purpose to demonstrate use case) |
I would like to add my personal findings. Adding the following to the GH Actions workflow file, actions/checkout@v2 will not create the container:
image: openjdk:16-jdk Simply removing the snippet, the workflow works fine again. I have run a simple test workflow just earlier and I've noticed that with the OpenJDK image, So this seems to rather be an issue with actions or docker not setting up the environment properly and not with this action, no? |
…et weird issues with the Github Checkout Action). actions/checkout#335
This causes an issue here: actions/runner#763 |
* - Implements a build hash string shown on the login page - Also fixes the borrel mode logout bug whoeps - Implemented AB testing * Implements AB testing in the workflows * Woops * Potential fix to get the .git dir * Fix was at the devvm * actions/checkout#335 * Maybe upgrade git works. * This works. * This works.
* Production A/B Testing (#17) * - Implements a build hash string shown on the login page - Also fixes the borrel mode logout bug whoeps - Implemented AB testing * Implements AB testing in the workflows * Woops * Potential fix to get the .git dir * Fix was at the devvm * actions/checkout#335 * Maybe upgrade git works. * This works. * This works. * Update docker.yml * Update docker.yml * Banner Fix (#18) * Banner timeout works now finally. * Update common.scss * Update Home.vue
For those looking to solve this issue this worked for me: |
Wouldn't it be better to fail if no git is found (maybe with an optional flag to use rest?) We have seen this happening multiple times with self hosted runners in the enterprise context where it would have saved a ton of debug time if the checkout action would not silently fall back to rest downloads. |
I think it can be controlled via this option . If it is
|
This was a weird one. I need runs-on: ${{ matrix.configs.runner }}
container:
image: ubuntu:22.04 For this to work the order of operations was important. Specifically:
Here's what works: steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y git
- uses: actions/checkout@v4
- name: Build binary
run: |
git config --global --add safe.directory "$(pwd)"
<build> |
minikube Make uses git log for getting the commit sha for minikube version,
git log doesn't work in checkouted source code
when I run
git log --pretty=oneline
I get this error:
The text was updated successfully, but these errors were encountered: