Search code examples
gitgithubgit-clone

git clone fails silently


To be more precise, I believe "git clone" succeeds, but immediately deletes all the files in my resulting local repo. A similar question can be found here, but I couldn't think of a way to phrase my twist on the question as an answer, so here I am.

Here's the rundown on the specifics of my scenario:

I have a repository on github. I am able to clone this repository as anyone would expect using git on Ubuntu 12.04. The problem arises when I try to clone the wiki (github makes this accessible via https://github.com/<owner>/<repository>.wiki.git). My resulting local copy is empty. Upon running "git status" I notice that the contents of the repo were deleted by some entity immediately after cloning.

On branch master

Changes to be committed:

(use "git reset HEAD ..." to unstage)

deleted: <filename>

...And so on for all the rest of the pages in my wiki.

"git branch -a" returns the same thing for me as for the other guy:

*master

remotes/origin/HEAD -> origin/master

remotes/origin/master

update 1

It's true I was not aware of the difference between the staging area and the working directory, but it seems that was not the issue. On the other hand, it may have revealed a bit more of what is wrong.

I forgot to mention that when I first clone the repository, I get the message "cannot stat <long_filename>: filename too long"

When I run "git reset" all of the deletions are listed under "unstaged changes after reset:". The odd one out is <long_filename> which is listed as a merge instead of a deletion. Still, no files are visible in the directory I cloned to after the reset.

update 2

I can view all the wiki entries that should be present by using gitk from the cloned folder, but I am quite certain that the files are not present in a raw format anywhere on my filesystem, otherwise "find / -name <filename> 2>/dev/null" should return some useful output.

update 3

Apparently one of my filenames is too long for git to manage. Checking out the repo again after cloning it got all the files but that one: error: unable to create file <filename>.md (File name too long)


Solution

  • git checkout . should discard all local changes since the last commit, reverting you back to a clean state.