Some colleagues and I have been working on a project stored in a private git repository. Historically, there have been no problems, but recently I attempted to clone, and got the following problem:
Cloning into 'project'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
A git log
provides:
fatal: your current branch 'master' does not have any commits yet
This isn't correct - my colleague pushed plenty of (nonempty) changes on Dec. 6 (although now that branch isn't showing on a --single-branch clone attempt). When he ssh's into the git repository, there is plenty of directory structure there.
So my questions:
If the repo is hosted on a gitlab server, and you used git over http
to clone the repo, it could be related to this:
Git over HTTP will receive an empty repo if giltab-git-http-server
is not properly configured
If for some reason
gitlab-git-http-server
is not properly configured, or you are using a custom nginx or Apache proxy that forwards directly to Unicorn and you attempt to clone via HTTP, the request succeeds, you receive a 200 and an empty repo.
A quick fix is to use git over ssh to clone the repo.
You have cloned the correct repository. I think they have not pushed into the master branch. The other branches will be there like origin/development-example. You need to make a local branch which can track the remote branches and then you can get the latest code. This is how you can track remote branches:
git branch --track dev-example origin/dev-example
git checkout dev-example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With