Skip to content
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

Error updating head reference while cloning #5

Closed
sirnewton01 opened this issue Jan 3, 2017 · 2 comments
Closed

Error updating head reference while cloning #5

sirnewton01 opened this issue Jan 3, 2017 · 2 comments

Comments

@sirnewton01
Copy link
Collaborator

When I try to clone a specific git repository I am getting an error updating head reference the following message:
"open .git/refs/heads/refs/heads/master: '.git/refs/heads/refs' does not exist"

The source of the error appears to come from cmd/reset.go around here:
https://github.com/driusan/go-git/blob/master/cmd/reset.go#L59

The branch name that comes back from c.GetHeadBranch() is "refs/heads/master," which is being appended to "refs/heads" creating a path that doesn't exist within the git repository.

@driusan
Copy link
Owner

driusan commented Jan 3, 2017

That's odd, I specifically remember fixing that. I'll have to check if it was on a WIP branch when I get home.

In the meantime, try changing that line to:

err := c.GitDir.WriteFile(git.File(branchName.String()),

Branch is a type of RefSpec, and as you pointed out, the refspec already contains the "refs/heads" portion of the filename.

@driusan driusan closed this as completed in 3410cd9 Jan 3, 2017
@driusan
Copy link
Owner

driusan commented Jan 3, 2017

(Actually I just quickly reproduced it and fixed it myself 3410cd9..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants