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:
- How could this have happened?
- How can we recover the repository? It seems the stuff is on the remote repo, but for some reason, it isn't aware that it's there.
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 clonned the correct repository. I think they have not pushed in master branch. The other branches will be there like origin/developemnt-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