Search code examples
gitgitlabgit-clone

Git only clones .git folder. Not all files


I am trying to clone repo. But doing so only get .git folder and not main files and folders. It shows success. But still not showing actual files and folders. It also shows receives objects (like 100% (2345/2345), 5.5 MB ). But not getting it in actual.

I used following command (which works for other repos).

git clone https://gitlab.com/myusername/test.git

Git Status Shows Following.

git status
On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)

git branch -avv shows following results.

git branch -avv
  remotes/origin/dev     0098fc5 cosmetics
  remotes/origin/release 2bf6eed rework oidc-client js sample logging code (#178)

Git Version shows following result.

git version
git version 2.10.2.windows.1

Solution

  • Your branch master seem to have just one initial empty commit

    Switch to develop

    git checkout --track -b dev origin/dev
    

    That should detect origin/dev and track it.

    Since master is the default branch being cloned, that is what you see by default when cloning a GitHub repo.
    See also "What determines default branch after “git clone”?"

    One way to avoid all this is to make sure the GitHub repo sets 'dev' as its default branch.