GitHub page and Hexo build an online blog

Source: Internet
Author: User
Tags file diff install node git commands

Directory:
    1. Installing node. js with Git
    2. Common git commands
    3. Installing Hexo
    4. Configure Hexo
    5. Hexo Release to GitHub

1. Install node. js and Git tools

https://nodejs.org/en/Direct download installs node. js, and some IDE comes with node. js, such as vs2015.

Console enter NPM to see if the NODE.JD is complete

Https://git-for-windows.github.io/windows version of Git

Https://desktop.github.com/github for Windows,

A detailed git tutorial can look at the git tutorial

2. Common git commands

git help <command># Show Command helpgit show # shows the content of a commit git show $idgit co--<file># Discard workspace Modify Git Co. # Discard workspace Modify git add<file># Commit Work file modifications to local staging area git Add. # Submit all modified work files to staging area git rm<file># Delete files from repository git rm<file>--Cached # Delete files from repository, but do not delete files git reset<file># Restore from staging area to working file git reset--. # Restore from staging area to working file git reset--Hard # Restores the state of the last commit, that is, discard all changes to the Git CI after the last commit<file> git ci. Git ci-a # git add, git rm and git ci are all combined to make Git ci-am"some comments"git ci--Amend # Modify the last commit record git revert< $id ># Restore the state of a commit, the recovery action itself also creates a commit object git revert HEAD # Restores the state of the last commit//View File diffgit diff<file># Compare current file and staging area file differences git diffgit diff<id1><id2># Compare the differences between two commits git diff<branch1&gt, .... <branch2># Compare git diff between two branches--staged # Compare staging area and repository diff git diff--Cached # Compare staging area and repository diff git diff--Stat # only compares statistics//View Commit recordgit log git log<file># View the file each time commit log git log-P <file># View Diffgit log for each detail modification-P-2# See Diffgit Log for last two detailed edits--stat #查看提交统计信息tigMac上可以使用tig代替diff和log, Brew install tiggit local branch management//view, toggle, create, and delete branchesgit br-r # View remote branch git BR<new_branch># Create a new branch git BR-v # View the last commit information for each branch git BR--merged # View the branch git BR that has been merged into the current branch--no-merged # View branches that have not been merged into the current branch git Co<branch># Switch to a branch git cob <new_branch># Create a new branch and switch past Git cob <new_branch> <branch># Create new New_branchgit Co $id based on Branch # Checkout a history commit record, but without branching information, switching to another branch will automatically delete the Git co $idb <new_branch># Make A history commit record checkout out, create a branch git br-D <branch># Delete a branch git br-D <branch># Force a branch to be removed (a branch that has not been merged will need to be forced when it is deleted)//Branch Merging and Rebasegit merge<branch># Merge branch branches into the current branch Git merge Origin/master--no-ff # Don't fast-foward Merge so that you can generate the merge commit git rebase master<branch> # rebase Master to branch, equivalent to: Git co <branch> && git rebase master && git Co master &A mp;& git merge <branch>//git patch management (for easy development of synchronization on multiple machines)git diff>.. /sync.patch # Build patch git apply:/Sync.patch # patching git apply--check. /Sync.patch #测试补丁能否成功//git staging managementgit stash # staged git stash List # column all stashgit stash apply # recover staged content git stash drop # Delete staging area//git remote branch managementgit Pull # Crawl all branch updates from remote repository and merge to local git pull--no-FF # Crawl All branches of the remote repository and merge them locally, don't fast-forward merge Git fetch Origin # crawl remote repository update Git merge Origin/Master # Merges the remote Master branch into the local current branch git co--track origin/Branch # Trace a remote branch to create the appropriate local branch git co-B <local_branch> origin/<remote_branch># Create local branch based on remote branch, function as above git push # push all branches Git push Origin master # push local landlord branch to remote main branch git push-u Origin Master # pushes the local landlord branch to remote (if no remote main branch is created to initialize the remote repository) Git push origin<local_branch># Create Remote Branch, origin is the remote repository name GIT push Origin<local_branch>:<remote_branch># Create a remote branch Git push origin:<remote_branch> #先删除本地分支 (git br-d <branch>), and then push to remove remote branch git remote repository management githubgit remotes-v # View remote server address and warehouse name git remote Show origin # View remote server warehouse status git remote add origin [email protected] Github:robbin/robbin_site.git # Add remote repository address git remoteSet-url origin [email protected] Github.com:robbin/robbin_site.git # Set the remote warehouse address (used to modify the remote warehouse address) git remote RM <repository># Delete Remote repositories//Create a remote warehousegit clone--Bare robbin_site robbin_site.git # Create a pure-version warehouse SCP with a versioned project-R my_project.git [email protected] git.csdn.net:~# Upload a pure repository to the server mkdir robbin_site.git&& CD robbin_site.git && git--Bare init # Create a pure repository git remote add origin [email protected] on the server Github.com:robbin/Robbin_site.git # Set remote warehouse address git push-u Origin Master # Client commits git push for the first time-u Origin Develop # First submits the local develop branch to the remote develop branch, and trackgit remoteSet-Head Origin Master # sets the head of the remote repository to point to the master branch//You can also command settings to track remote libraries and local librariesgit branch--Set-upstream Master origin/Mastergit Branch--Set-upstream Develop Origin/develop
git command

3. Installing Hexo

Hexo's website: https://hexo.io/

Enter the following command in git to install directly

NPM install-g HEXO-CLI

And then run

Hexo init <floder><floder>npm Install

After the installation is complete, you can see the corresponding folder under the directory.

.

├──_config.yml

├──package.json

├──scaffolds

├──scripts

├──source

| ├──_drafts

| └──_posts

└──themes

Hexo g #生成博客静态文件 generatehexo s #启动本地服务器 server

If you are prompted: Hexo server Usage:hexo <command>, because a later version of Hexo 3 requires a manual installation of the server module, execute the following command:

NPM Install Hexo-server--save

Running successfully prompts you to view the site in localhost:4000

3. Configure Hexo

is mainly to modify the _config.yml,

# Deployment
# # Docs:http://hexo.io/docs/deployment.html
deploy:
Type  #部署工具的类型
  repository: git@github  #SSH链接
#分支

If the deployment fails, try to add GitHub SSH again, and then test to see if it can be linked to GitHub

ssh–t [email protected]

4.hexo Release to GitHub

The GitHub operation is not described in detail and it is important to note that new repositories needs to change the project name to Username.github.com.

Then deploy the Hexo to the GitHub page

Hexo D

Wait for completion, 10 minutes after entering Username.github.io view (if the CSS is not added should be a domain name unbound problem, add a CNAME file in the root directory, add your own domain name).

GitHub page and Hexo build an online blog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.