所需安装程序
配置Git密钥(SSH)
填写你都git账号信息
1
2
3git config --global user.name "leewinmen"
git config --global user.email leewinmen@qq.com
ssh-keygen -t rsa -C "leewinmen@qq.com"之后是ssh,到C:\Users\你的名字\ .ssh文件夹\ id_rsa.pub,打开它,复制到github或码云或者coding。具体可以看
http://blog.darler.cn/hexo-coming/#码云和coding的部署
这里需要回车3次
- 在Git中输入以下命令验证与github连接是否成功,
1 | ssh -T git@github.com #对于github |
输入yes回车
(4.1在git clone失败后使用)
开始操作
本地创建一个文件夹存放git,比如我是在桌面的test文件夹
1 | cd desktop/test |
如果只是要里面的代码,用git clone,克隆仓库到本地。
1 | git clone https://github.com/leewinmen/leewinmen.github.io |
上传文件到仓库
需要先把需要上传的文件放到clone下来的文件夹对应位置
1 | git add . #不要漏了后面空格加一个小写的句号 |
删除的文件or文件夹
1 | cd xxx.github.io #进入克隆下了的仓库文件夹,需要删除文件的目录下 |
-u origin master可换为你的仓库https,比如
1 | git push https://github.com/leewinmen/leewinmen.github.io |
其他
1 | git status #查看git当前状态 |
总结
归根到底,删除或者增加,或者改动,就是一个思路。
1 | git add . |
1 | git commit -m 'darler' |
1 | git push -u origin master |
我遇到的坑
GitHub创建博客报错404 There isn’t a GitHub Pages site here.
解决方案:
1.进入setting
2.找到GitHub Page,点击Change theme(设置之后即可访问)