Closed easonyq closed 5 years ago
I also have the same problem. But it worked when I used:
ref, err := repo.Reference(plumbing.HEAD, false)
The second parameter means that you want a hash reference. In a newly created repo master
does not point to any commit because no commits exist. When false it returns a symbolic ref, the same as your git example.
I've just init a normal repo by
PlainInit
and then check its current branch. I called:and get an error said "reference not found".
But when I use Git CLI tools and "refs/heads/master" is the result.