创建GitHub页面回复 [英] Creating GitHub Pages Repo
问题描述
username.github.com/repo-name
有关设置username.github.com/repo-name *的说明
cd / path / to / repo-name
git symbolic-ref HEAD refs / heads / gh-pages
rm .git / index
git clean -fdx
echoMy GitHub Page> index.html
git add。
git commit -a -m第一页提交
git push origin gh-pages
我这样做了: cd / path / to / repo-name
在我完成 git clean -fdx 后,被删除。我必须从github下载它们。
这个(
您看到的命令旨在创建一个空分支 gh-pages
。
它不是一个新的目录,而是一个新的分支,没有链接到你的主人和其他分支,并在那里添加github页面相关的内容。它一定是作为第一步完成的,但是添加文件后可能已经完成了,这可能没有问题。阅读gh-pages wiki上的说明。它解释了为什么需要上述命令,并警告您会丢失文件,就像您一样 - http:// pages .github.com /
您也可以使用 git checkout --orphan gh-pages
作为一个替代方案。
请参阅我的答案:如何在Git中没有父级创建提交?
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 ?
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?
这篇关于创建GitHub页面回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!