Skip to content

[Question] Unshallow Git repository in GitLab #2358

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

Closed
faina09 opened this issue Jul 16, 2020 · 7 comments
Closed

[Question] Unshallow Git repository in GitLab #2358

faina09 opened this issue Jul 16, 2020 · 7 comments
Labels

Comments

@faina09
Copy link

faina09 commented Jul 16, 2020

Describe the bug
I have a simple .net core 3.1 project in VS2019 including GitVersionTask Version=5.3.7 that normally compiles in VS.
I have a GitLab job that compiles too if GitVersionTask is removed from packages

Expected Behavior

compilation by gitlab job

Actual Behavior

I got an error:

C:\Users\xxxx\.nuget\packages\gitversiontask\5.3.7\build\GitVersionTask.targets(46,9): error : GitVersionException: Cannot find commit 37263fb6bcfabee8cff19327eb128314dd5c7be3. Please ensure that the repository is an unshallow clone with git fetch --unshallow. [C:\Gitlab-Runner\builds\3VbVuPNg\0\xxxx\blazor\BlazorApp1\BlazorApp1.csproj]

and cannot continue the compilation.

Possible Fix

  • remove GitVersionTask from packages (!)
  • may be something like this ? (search for "GitVersionTask")

Steps to Reproduce

difficult: it seems to depend from our GitLabRunner for windows application, the previous one was working fine (see Environment)

Context

Environment

  • .net core 3.1
  • gitlab-runner 13.1.1 (working with previous gitlab-runner 11.2.0)
  • Windows Server 2019 STD
  • GitLab Community Edition 13.1.4
  • my CI build contains: dotnet publish BlazorApp1.csproj -c Pre-release
@faina09 faina09 added the bug label Jul 16, 2020
@asbjornu
Copy link
Member

Are you unable to make the repository unshallow?

@faina09
Copy link
Author

faina09 commented Jul 16, 2020

I do not know how to do this.

@faina09
Copy link
Author

faina09 commented Jul 16, 2020

Solved!
in my CI build .gitlab-ci.yml I added:

variables:
  GIT_DEPTH: "1000"

thanks to @asbjornu for push me in the right direction

@faina09 faina09 closed this as completed Jul 16, 2020
@asbjornu asbjornu added question and removed bug labels Jul 16, 2020
@asbjornu asbjornu changed the title [Bug] [Question] Unshallow Git repository in GitLab Jul 16, 2020
@embix
Copy link

embix commented Jul 12, 2021

Are you unable to make the repository unshallow?

I do not know how to do this.

Simply add git fetch --unshallow: to the related before_script: section (script should work too):

  before_script:
    # use unshallow instead of GIT_DEPTH
    - git fetch --unshallow --all

Thus you don't get annoyed, once you hit the 1000 commits threshold (this is when you consider updating the value to 10000).

@jeanplevesque
Copy link
Contributor

FYI
If you're seeing this error from Azure Pipelines, know that it can be symptom of a recent change to default options.

@SR-Sable-IT-Services
Copy link

Are you unable to make the repository unshallow?

I do not know how to do this.

Simply add git fetch --unshallow: to the related before_script: section (script should work too):

  before_script:
    # use unshallow instead of GIT_DEPTH
    - git fetch --unshallow --all

Thus you don't get annoyed, once you hit the 1000 commits threshold (this is when you consider updating the value to 10000).

Hello, I Tried both - git fetch --unshallow and GIT_DEPTH: "1000"
both not worked for me still I'm getting warning in sonar job as below.
[WARNING] Shallow clone detected, no blame information will be provided. You can convert to non-shallow with 'git fetch --unshallow'.

@mc0re
Copy link

mc0re commented Jul 15, 2024

Just stumbled upon this problem in an Azure pipeline executed on a home-made VM. Possibly I lack some setting somewhere.

Reported as a new issue: #4094

bigsaltyfishes added a commit to MolaFarm/MolaLabServerProxy that referenced this issue Oct 26, 2024
bigsaltyfishes added a commit to MolaFarm/MolaLabServerProxy that referenced this issue Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants