git clone fatal: 'origin' does not appear to be a git repository for VMware vmhgfs share

9

1

I'm getting this "fatal: 'origin' does not appear to be a git repository" error while doing git clone (go get) .

$ git clone https://github.com/andybalholm/cascadia /path/to/Go/src/github.com/andybalholm/cascadia
Cloning into '/path/to/Go/src/github.com/andybalholm/cascadia'...
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

The existing answers I found from SO are either about git push (with wrong .gitconfig) or having the wrong permission, which I've double checked to have rule it out.

I never had such problem before, but this is a brand new Ubuntu 16.04 LTS Xenial machine, and I'm using the Ubuntu official go1.6 for the first time as well.

let me first insist that this is not the wrong permission problem, as I've created /path/to/Go/src/github.com/andybalholm/cascadia myself without any problem.

However, further investigate confirmed that it is in fact the wrong permission problem -- My Ubuntu 16.04 is in VM, and its vmhgfs share somehow allows me but not git command to operate in there.

So, once again,

  • Ubuntu 15.04, with VMware's own VMware Tools, git clone into vmhgfs share works fine.
  • Ubuntu 16.04, with open-vm-tools-desktop, git clone into vmhgfs share won't work, error as reported above.

Anyone know any workaround? Thanks

xpt

Posted 2016-05-20T18:56:10.793

Reputation: 5 548

Answers

12

I had the same problem, also in a VM (although Ubuntu 14.04 under VMWare Workstation). The problem was a permissions problem between my Ubuntu VM guest user and my Windows host user. Although on the VM I can create directories and files on the Windows file system mounted within the VM, the "go get" had the same error you did.

I did not get the error if I ran "go get" in a VM local directory (~/golang for example).

I don't know yet how to fix the permissions issues (sudo didn't help) or where in the stack the permissions problems are occurring. As a work-around, I run "go get" in my local VM directory (~/golang) and then move or copy the created files into the go directory I want them in on my mounted file system.

David Sturman

Posted 2016-05-20T18:56:10.793

Reputation: 136

3Yep, exactly the way I solve it as well. Thanks, and, Oh, welcome aboard! – xpt – 2016-06-09T13:36:13.793

Here's another piece to the puzzle. Try this...init a new repo, then add a remote to it. E.g., git remote add origin uri. Now take a look at the .git/config file. It shows the remote and the fetch-spec, but not the url key. I.e., by any means I can discover, it's impossible to successfully add a URI-based remote when the repo is on an affected vmhgfs share. I think it's a pretty reasonable guess that this behavior is the underlying cause of the git clone failure. I observed this in Ubuntu 16.04 with git 2.7.4 and git 2.13.0. – John Fultz – 2017-07-01T21:38:15.677

Thanks a lot! very weird issue. Maybe something related or the same problem as this?

– PieCot – 2018-06-25T20:24:52.527