1

username.github.com/repo-name

Instructions for setting up username.github.com/repo-name *

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" > index.html
git add .
git commit -a -m "First pages commit"
git push origin gh-pages

I did this : cd /path/to/repo-name
After I did git clean -fdx, all my files got deleted. I had to download them from github.

Was this (cd /path/to/repo-name) meant to be on a new directory ?

anjanesh
  • 3,771
  • 7
  • 44
  • 58

1 Answers1

6

The commands that you are seeing are meant to create an empty branch gh-pages.

It is not meant to be a new directory, but a new branch, with no link to your master and other branches and add the github pages related content in there. It must have been done as a first step, but you might have done it after adding files, which might be fine. Read the instructions on the gh-pages wiki. It explains why the above commands were needed and also warns that you will lose the files, like you did - http://pages.github.com/

You can also use git checkout --orphan gh-pages as an alternative.

See my answer here: How do I create a commit without a parent in Git?

Community
  • 1
  • 1
manojlds
  • 290,304
  • 63
  • 469
  • 417