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.

Cloning a tag fails during checkout

See original GitHub issue

I can successfully clone a specific branch by passing a ref value. However when I try to clone a tag (lightweight) it fails. From what I can tell the fetch works but it fails during checkout trying to resolve the ref origin/tag-name

I’m cloning with:

    await git.clone({
      // ...
      ref: 'tag-name',
    });

I see that fetch has a tags argument but clone never passes it so my guess is that the initial fetch does not include the tags.

Thanks for this awesome library

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wmhiltoncommented, Mar 16, 2018

OK, think I found a fix. It was a little more subtle than I expected. Passing tags: true to fetch was the first step. But then, because tags are not stored under “refs/heads/remotes” like remote branches but in “refs/tags”, it was erroneously telling the server “I already have that commit” when it was trying to clone it.

1reaction
wmhiltoncommented, Mar 15, 2018

Yes, tag support isn’t at 100% yet. I’ll add a test for cloning by tag name and see I can get that to pass. It might be as simple as passing {tags: true} to fetch during clone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git checkout to a tag after clone gives error - Stack Overflow
You have to fetch all tags from the remote. Execute the command git fetch --tags and then try to check out.
Read more >
Unable to clone a repository with specific tag and depth on ...
Unable to clone repository with specific tag and depth on Windows using the following command: git clone --branch <branch-name> --depth 1 ...
Read more >
How to clone from a git tag example - TheServerSide.com
Just perform the clone and specify the tag name with the branch option. git clone tag example target. This git clone tag example...
Read more >
[JENKINS-47433] CLI git clone of specific tag fails in pipeline
When cloning a project with the git plugin and asking it to fetch a specific tag instead of the master branch, it fails...
Read more >
Cannot find tag when cloning repository - Builds
It's really unclear why the tag cannot be retrieved. Seems as a cache problem but why? This happened once in the past for...
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