git init/add/push never added files to repo, and now they've been deleted locally

I followed the official directions to create a new repo through terminal. Terminal output showed:

Writing objects: 100% (3/3), 228 bytes | 228.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
 * [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

but none of the files showed up in my github browser UI. Refreshing had no result.

I reinitiallized, with no errors.

I edited the README.MD in the browser, and then had my git push rejected. Git pull resulted in:

remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
   2c27705..82d4e9e master -> origin/master
Updating 2c27705..82d4e9e
 README.MD | 4 ++++
 1 file changed, 4 insertions(+)

Git checkout showed all of my files. However, none were accessible or visible through the github UI.

git push origin HEAD:master showed Everything up to date. Various searched suggested combinations of reset HEAD master. The files in my local directory have now all been deleted. When I look at the commit history, there are no files accessible there either.

Have I lost my files permanently? What is the correct way to create a repo from a pre-existing local directory?

Hi @zeesy,

Thanks for reaching out! Please drop us a note at with the info so we can look into that further. The support team might be able to recover your files. 

I hope this helps!


Thanks, Andrea. It was test code for an exercise, so I was able to rewrite it. If the issue comes up again I will contact you at support directly.