question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:

 Not a git repository (or any of the parent directories): .git

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:22
  • Comments:24

github_iconTop GitHub Comments

21reactions
RaiBnodcommented, Nov 28, 2020

I was using self-hosted runner. And it had no .git folder showed me logs as below:

Getting Git version info
  Working directory is '/root/actions-runner/_work/<project>/<project>'
  /usr/bin/git version
  git version 2.17.1
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Downloading the archive
Writing archive to disk
Extracting the archive

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 ubuntu-latest instead of self-hosted and it showed me log something like this:

Getting Git version info
  Working directory is '/home/runner/work/<project>/<project>'
  /usr/bin/git version
  git version 2.28.0
Initializing the repository
  /usr/bin/git init /home/runner/work/<project>/<project>
  Initialized empty Git repository in /home/runner/work/<project>/<project>/.git/
  /usr/bin/git remote add origin https://github.com/<org>/<project>
Disabling automatic garbage collection
  /usr/bin/git config --local gc.auto 0

After comparing those two logs: one is using Git version: 2.17.1, and another one is using Git version: 2.28.0.

Hence, after updating the Git version (>= 2.18) into latest one, the issue got resolved in my case.

14reactions
pwoolvettcommented, Jan 19, 2021

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 checkout action, or, if the runner is a docker container, add as a RUN command

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where is my local repository? (no .git directory) - Stack Overflow
Go to explorer · Select Organise · Select Folder and Search Options · Select View tab · Check Show hidden files, folders and...
Read more >
What is .git folder and why is it hidden? - Tutorialspoint
The .git folder contains all information that is necessary for the project and all information relating commits, remote repository address, ...
Read more >
What is Dot Git Folder in Git and What happens if we delete ...
As you notice, .git is not present in the list. By this, we have deleted our .git folder and the entire work we...
Read more >
How to Fix the “fatal: not a git repository” Error - ContainIQ
Make sure you correctly typed the name of the directory. · Check that you correctly created the repo. If the directory doesn't contain...
Read more >
I lost my .git folder. I have a copy of the structure on my local ...
You can just git init in that directory and start a new repo but there is no way to get your old commits...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found