标签:
Now let‘s take you through how to publish your site via GitHub pages. We aren‘t saying this is the only way or even best way to publish your site, but it is free, fairly simple, and touches upon some new skills that you‘ll find useful going forward.
This is where we will have a go at using the command line to put our repository on GitHub. A command line is a window where you type in commands to do things like create files and run programs, rather than clicking inside a user interface. It will look something like this:
Note: You could also consider using a Git graphical user interface to do the same work, if you feel uncomfortable with the command line.
Every operating system comes with a command line tool:
This may seem a bit scary at first, but don‘t worry — you‘ll soon get the hang of the basics. You tell the computer to do something in the terminal by typing in a command and hitting Enter.
test-site
directory (or whatever you called the directory containing your website). For this, use the cd
command (i.e. "changedirectory"). Here‘s what you‘d type if you‘ve put your website in a directory calledtest-site
on your desktop:
cd Desktop/test-site
git
tool turn the directory into a git repository:
git init
git remote add origin https://github.com/bobsmith/bobsmith.github.io.git
git add --all git commit -m ‘adding my files to my repository‘
git push -u origin master
Note: If you get stuck, the GitHub Pages homepage is also really helpful.
If you want to make more changes to your test site and upload those to GitHub, you simply need to make the change to your files just like you did before. Then, you need to enter the following commands (pressing Enter after each one) to push those changes to GitHub:
git add --all git commit -m ‘another commit‘ git push
You can replace another commit with a more suitable message to describe what change you just made.
We have barely scratched the surface of Git. To learn more, start off with the GitHub Help site.
By this point, you should have your sample website available at a unique web address. Well done!
标签:
原文地址:http://www.cnblogs.com/hephec/p/4601177.html