Cloning a tag fails during checkout
See original GitHub issueI 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:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.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.