On CircleCi getting: fatal: log for 'main' only has 1 entries

In my circleci config, as usual, I am checking out my private repo with the - checkout step.
All fine, it pulls the repo… as you can see from the logs

Using SSH Config Dir '/home/circleci/.ssh'
git version 2.33.0
Cloning git repository
Cloning into '.'...
Warning: Permanently added the ECDSA host key for IP address 'xxx' to the list of known hosts.
remote: Enumerating objects: 1813, done.        
remote: Counting objects: 100% (415/415), done.        
remote: Compressing objects: 100% (238/238), done.        
remote: Total 1813 (delta 188), reused 315 (delta 148), pack-reused 1398        
Receiving objects: 100% (1813/1813), 549.07 KiB | 20.33 MiB/s, done.
Resolving deltas: 100% (889/889), done.
Checking out branch
Reset branch 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at 2578755 adding changes in theme tokens set (#55)

Then at some point late in my workflow, in another job I am need to check the git diff between the current main branch and the previous state of main (main is my master).

I do it running the command:
git diff --name-only main@{1}..main

Locally works great but on the pipeline I get the following error:

fatal: log for 'main' only has 1 entries

I thought was because I did not have all the commit history, but CircleCi does not do a shallow pull. Infact checking the commit logs I have many. 98. So it is not that, and checking the current branch it is correctly main.

I am on version 2.1.

Is there anything I am missing? I do not get why I am getting the error. Again, locally is good, but not on circle Ci and seems like the repo got pulled correctly? Need some authorizations for circleCI enabled?

Thank you.

Probably it did fall in git issues. But anyway I solved my problem using the command

git diff main HEAD~1 --name-only instead

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.