Typora是很多朋友写Markdown的首选工具,Typora用Pandoc作为文件转换工具,PicGo作为图床工具,安装和配置都很简单。
只是配置GitHub图床经常遇到上传失败的问题,今天就把遇到的PicGo+GitHub图床配置问题做日志备忘,同时希望能分享给需要的朋友们(第三部分)。
一、所需软件包
Typora 0.9.93(Beta)
https://www.typora.io/
Pandoc 2.10.1
https://github.com/jgm/pandoc/releases
PicGo 2.3.0(Beta)
https://github.com/Molunerfinn/PicGo/releases
GitHub下载非常慢,需要的朋友们可以见文末网盘。
二、PicGo+GitHub图床配置
如下是PicGo官方GitHub图床配置教程,供参考:
{ "repo": "", // 仓库名,格式是username/reponame "token": "", // github token "path": "", // 自定义存储路径,比如img/ "customUrl": "", // 自定义域名,注意要加http://或者https:// "branch": "" // 分支名,默认是master}
1. 首先你得有一个GitHub账号。注册GitHub就不用我多言。
2. 新建一个仓库:并记下你取的仓库名。
![140acbc78f6d9f77835b2fa6e90a7474.png](https://i-blog.csdnimg.cn/blog_migrate/c9c2d190193046984f2d773267501f93.jpeg)
3. 生成一个token用于PicGo操作你的仓库:
访问:https://github.com/settings/tokens
然后点击Generate new token。
![123cfaa13fe2694c05a315194e705625.png](https://i-blog.csdnimg.cn/blog_migrate/0fa03223c95aae064851761aad3ca610.jpeg)
把repo的勾打上即可。然后翻到页面最底部,点击Generate token的绿色按钮生成token。
![6d6a5771302016bed872c26a68d47720.png](https://i-blog.csdnimg.cn/blog_migrate/0368b3ecbd9ad079962985ce940e7014.jpeg)
**注意:**这个token生成后只会显示一次!你要把这个token复制一下存到其他地方以备以后要用。
![61d8dd41e548f280761a920fd2abfae1.png](https://i-blog.csdnimg.cn/blog_migrate/055ef9253a99374760c95c130a636744.jpeg)
4. 配置PicGo
**注意:**仓库名的格式是用户名/仓库,比如我创建了一个叫做test的仓库,在PicGo里我要设定的仓库名就是Molunerfinn/test。一般我们选择master分支即可。然后记得点击确定以生效,然后可以点击设为默认图床来确保上传的图床是GitHub。
![f313bea3c3dcbca35f28e1d70375fdb2.png](https://i-blog.csdnimg.cn/blog_migrate/b08e76a66024bde0586ce6e2fbfeb1b7.jpeg)
至此配置完毕,已经可以使用了。当你上传的时候,你会发现你的仓库里也会增加新的图片了。
三、PicGo+GitHub图床配置问题
经过如上配置,朋友们如果发现图片上传还是失败,配置容易出错的地方是:
1、仓库名有空格;
解决办法:重新确认设置。
2、上传的图片文件名有空格或特殊符号;
解决办法:建议开启上传前重命名,或时间戳重命名,以避免文件名错误。
3、已上传过同名文件,导致上传失败;
解决办法:建议开启上传前重命名,或时间戳重命名,以避免文件名重名。
![ccce83fd8ca6504d8ed60e70ac44dbb5.png](https://i-blog.csdnimg.cn/blog_migrate/705c9908d83280f7ff8aa68984ecf6df.jpeg)
4、自定义域名错误;
解决办法:自定义域名可以不填,避免自定义域名错误。
不填默认的域名是:https://raw.githubusercontent.com/仓库名/分支名/
![596f406a27c073dd754c81b17223127f.png](https://i-blog.csdnimg.cn/blog_migrate/32fc56ccd56fddba495d0a6c40f1641b.jpeg)
5、域名解析错误;
解决办法:设置hosts.
这种情况往往容易被忽视,今天配置上传失败,排查了3个小时,设置hosts后正常上传。
打开C:windowsSystem32driversetchosts,在其中添加下面的内容:
# GitHub Start192.30.255.112 gist.github.com192.30.255.112 github.com192.30.255.112 www.github.com151.101.56.133 avatars0.githubusercontent.com151.101.56.133 avatars1.githubusercontent.com151.101.56.133 avatars2.githubusercontent.com151.101.56.133 avatars3.githubusercontent.com151.101.56.133 avatars4.githubusercontent.com151.101.56.133 avatars5.githubusercontent.com151.101.56.133 avatars6.githubusercontent.com151.101.56.133 avatars7.githubusercontent.com151.101.56.133 avatars8.githubusercontent.com151.101.56.133 camo.githubusercontent.com151.101.56.133 cloud.githubusercontent.com151.101.56.133 gist.githubusercontent.com151.101.56.133 marketplace-screenshots.githubusercontent.com151.101.56.133 raw.githubusercontent.com151.101.56.133 repository-images.githubusercontent.com151.101.56.133 user-images.githubusercontent.com# GitHub End
这一顿图床配置操作,将Typora图片设置成图床模式,以后就可以无缝的编辑含图片的Markdown文档了。
![b7dd3eea6ba7ed78e56ecf556d73ce40.png](https://i-blog.csdnimg.cn/blog_migrate/3ca9ae2e65d729158ab6ede59f0ab296.jpeg)
以上是个人配置PicGo+GitHub图床的一点经验,抛砖引玉,希望朋友们交流指正。
GitHub下载慢的朋友,也可以通过如下方式获取:
Typora+Pandoc+PicGo下载网盘链接:关注+私信“Typora”
![eede5e7d67e331d9e1c2786d3e5522b3.gif](https://i-blog.csdnimg.cn/blog_migrate/54bc1210f7e66bfee1601ae7f83756cf.gif)