windows下github管理

以前用mac搭建的github,使用hexo主题,后来换了windows电脑后,重新管理github,查找资料后整理一下笔记

1. 首先要在windows下安装git,这个不用多说

2. 右键鼠标,选中 “Git Bash here”,当然你也可以在windows的 “开始”--->“所以程序”,或者安装目录打开它


3. 输入指令,进入.ssh文件夹


4. 如果提示 “ No such file or directory”,你可以手动的创建一个 .ssh文件夹即可 mkdir ~/.ssh

5. 配置全局的name和email,这里是的你github的name和email

$ git config --global user.name "cocosgirl"
$ git config --global user.email "zyy1152****[email protected]"
6、生成SSH密钥过程:
a.查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
b.生存密钥:
$ ssh-keygen -t rsa -C "zyy1152****[email protected]"

按3个回车,密码为空。

Your identification has been saved in /c/Users/Administrator.SC-201803281014/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator.SC-201803281014/.ssh/id_rsa.pub.
The key fingerprint is:
………………


最后在.ssh目录下得到了两个文件:id_rsa和id_rsa.pub


c.把id_rsa.pub用工具打开,复制所有内容,添加到github的ssh密钥里(注:这里用的是公钥)

7. 添加完之后测试

$ ssh [email protected]
The authenticity of host 'github.com (13.250.177.223)' can't be established.
RSA key fingerprint is SHA256:nThbg6UpJWGl7E1IGOCspRomTxdCARLviKw6EY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,13.250.177.223' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi cocosgirl! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

8. 安装hexo

因为hexo是基于node.js的,所以node.js是必须要装的nodejs下载,直接点击下一步安装,安装好以后,打开CMD命令窗口,输入 npm -v ,如果出现版本号,那说明安装成功了并且环境变量也配置好了,如果是未知命令那就要配置一下环境变量。

然后安装hexo,打开CMD,输入以下命令,这一步比较慢

npm install -g hexo-cli

安装完之后,输入 hexo -v 出现一系列的版本号就是安装成功啦,如下:

$ hexo -v
hexo-cli: 1.1.0
os: Windows_NT 6.1.7601 win32 x64
http_parser: 2.8.0
node: 8.11.2
v8: 6.2.414.54
uv: 1.19.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.29.0
napi: 3
openssl: 1.0.2o
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c

9. 安装写作工具(可以飘过,按个人喜好下载)

我安装的码字工具,下载markdown

10. 开始使用github

1.获取源码:

$ git clone [email protected]:cocosgirl/cocosgirl.github.io.git

11.若出现hexo d不成功的情况:

修改配置文件:根目录下的_config.yml,修改deploy节点。

原来的配置为:

deploy:

type: git

repo: https://github.com/{yourname}/{yourname}.github.io

branch: master

修改为如下:

deploy:

type: git

repo: https://{yourname}:{yourpassword}@github.com/{yourname}/{yourname}.github.io.git

branch: master


 github添加密钥及使用参考:

https://blog.csdn.net/hustpzb/article/details/8230454/

https://blog.csdn.net/lsyz0021/article/details/52064829

安装hexo参考:

https://www.jianshu.com/p/343934573342

windows下好用的写作工具推荐:

https://sspai.com/post/42126

猜你喜欢

转载自blog.csdn.net/cocos2dgirl/article/details/80355362