Configuring and using Github
The following tutorial is mainly written with reference to beiyuu's "Using Github Pages to Build an Independent Blog".
Configure SSH keys
How do we connect the local git project with the remote github? Use SSH keys.
Check the settings of SSH keys
First we need to check the existing ssh key on your computer:
$ cd ~/.ssh Check the local ssh key
If it prompts: No such file or directory, it means you are using git for the first time.
Generate new SSH Key:
$ ssh-keygen -t rsa -C "email address@youremail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):<Just press Enter>
Note 1: For the email address here, you can enter your own email address; Note 2: The "-C" here is a capital "C"
Then the system will ask you to enter your password:
Enter passphrase (empty for no passphrase):<Enter the encrypted string>
Enter same passphrase again:<Enter the encrypted string again>
When you press Enter, you will be prompted to enter a password. This password will be used when you submit the project. If it is empty, you do not need to enter it when submitting the project. This setting is to prevent others from submitting content to your project.
Note: There is no * when entering the password, you can just enter it directly.
Finally when I saw this interface, I successfully set the ssh key:
Add SSH Key to GitHub
After setting the SSH Key on this machine, it needs to be added to GitHub to complete the setting of the SSH link.
1. Open the local C:Documents and SettingsAdministrator.sshid_rsa.pub file. The content in this file is the key generated just now. If you can't see this file, you need to set it to show hidden files. Accurately copy the contents of this file to ensure successful setup.
2. Log in to the github system. Click Account Settings--->SSH Public keys in the upper right corner ---> add another public keys
3. Copy your locally generated key into it (key text box), click add key and it’s OK
Test
You can enter the following command to see if the setting is successful. Do not modify the git@github.com part:
$ ssh -T git@github.com
If it is the following feedback:
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
Don’t be nervous, just enter yes and you will see:
Hi cnfeat! You've successfully authenticated, but GitHub does not provide shell access.
Set user information
Now that you can connect to GitHub via SSH, there are still some personal information that need to be completed.
Git will record submissions based on the user's name and email address. GitHub also uses this information to process permissions. Enter the following code to set personal information, and replace the name and email with your own. The name must be your real name, not your GitHub nickname.
$ git config --global user.name "cnfeat"//Username
$ git config --global user.email "cnfeat@gmail.com"//Fill in your own email
SSH Key configured successfully
This machine has successfully connected to github.
If there is any problem, please reset it. Please refer to common mistakes:
hexo delete blog
Delete inside the warehouse
source/_posts/我的文章.md
Execute the following command to update the blog
hexo g
==hexo generate
#生成hexo s
==hexo server
#启动服务预览hexo d
==hexo deploy
#deploymentGenerate ssh method, multiple shh
1. Generate a key with the specified name
ssh-keygen -t rsa -C "邮箱地址" -f ~/.ssh/github_jslite
2. Copy the key to the hosting platform
vim ~/.ssh/github_jslite.pub
3. Modify the config file
vim ~/.ssh/config
#修改config文件,如果没有创建config
Add to the blog’s config file
4.Test
ssh -T git@jslite.github.com
#@
followed by the defined HostJust follow the steps to generate the key again.
Just delete the corresponding md files in ./source/_posts/, but you cannot delete them all, and an error will be reported.
ps: hexo version: 3.0.0
Configuring and using Github
The following tutorial is mainly written with reference to beiyuu's "Using Github Pages to Build an Independent Blog".
Configure SSH keys
How do we connect the local git project with the remote github? Use SSH keys.
Check the settings of SSH keys
First we need to check the existing ssh key on your computer:
$ cd ~/.ssh Check the local ssh key
If it prompts: No such file or directory, it means you are using git for the first time.
Generate new SSH Key:
$ ssh-keygen -t rsa -C "email address@youremail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):<Just press Enter>
Note 1: For the email address here, you can enter your own email address; Note 2: The "-C" here is a capital "C"
Then the system will ask you to enter your password:
Enter passphrase (empty for no passphrase):<Enter the encrypted string>
Enter same passphrase again:<Enter the encrypted string again>
When you press Enter, you will be prompted to enter a password. This password will be used when you submit the project. If it is empty, you do not need to enter it when submitting the project. This setting is to prevent others from submitting content to your project.
Note: There is no * when entering the password, you can just enter it directly.
Finally when I saw this interface, I successfully set the ssh key:
Add SSH Key to GitHub
After setting the SSH Key on this machine, it needs to be added to GitHub to complete the setting of the SSH link.
1. Open the local C:Documents and SettingsAdministrator.sshid_rsa.pub file. The content in this file is the key generated just now. If you can't see this file, you need to set it to show hidden files. Accurately copy the contents of this file to ensure successful setup.
2. Log in to the github system. Click Account Settings--->SSH Public keys in the upper right corner ---> add another public keys
3. Copy your locally generated key into it (key text box), click add key and it’s OK
Test
You can enter the following command to see if the setting is successful. Do not modify the git@github.com part:
$ ssh -T git@github.com
If it is the following feedback:
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
Don’t be nervous, just enter yes and you will see:
Hi cnfeat! You've successfully authenticated, but GitHub does not provide shell access.
Set user information
Now that you can connect to GitHub via SSH, there are still some personal information that need to be completed.
Git will record submissions based on the user's name and email address. GitHub also uses this information to process permissions. Enter the following code to set personal information, and replace the name and email with your own. The name must be your real name, not your GitHub nickname.
$ git config --global user.name "cnfeat"//Username
$ git config --global user.email "cnfeat@gmail.com"//Fill in your own email
SSH Key configured successfully
This machine has successfully connected to github.
If there is any problem, please reset it. Please refer to common mistakes:
GitHub Help - Generating SSH Keys
GitHub Help - Error Permission denied (publickey)
http://www.jianshu.com/p/05289a4bc8b2