Github+PicGo+jsdelivr 搭建免费图床

创建github仓库

  • 新建仓库:github右上角,点击+,创建

  • 填写仓库信息,注意:仓库必须设置为public,不然只能存储,不能外部访问

  • 创建token:点击github头像,选择settings

  • 选择左边菜单最下面的 developer settings

  • 选择Personal access tokens

  • 点击generate new token,输入note,并勾选repo后,直接拉到底部,点击generate token

  • 拷贝生成的token,最好是备份一下,只能看到一次

picGo客户端设置

下载地址:github地址
配置:

  • 仓库名:[username]/[仓库名]
  • 分支名:默认是master
  • token:之前拷贝那串字符
  • 路径:自定义,例如 img/ ,上传的图片就放在img文件夹中
  • 自定义域名:https://raw.githubusercontent.com/[username]/[仓库名]/master

配置jsDelivr–cdn加速

  • 在github的仓库中选择release

  • 选择 draf new release

  • 填写版本号,例如v1.0、相关描述,点击生成即可

  • 通过jsdelivr访问

https://cdn.jsdelivr.net/gh/<github账号>/<仓库名称>@<版本号>/<文件路径>/<文件名>

不输入版本号默认访问最新版本

例如:
https://raw.githubusercontent.com/chenjialin1016/ImageCloud/master/blog_files/img/PicGo_Github-PicBed/27A24F83-16F8-4B9D-A0BE-D31867163D1D.png

改为
https://cdn.jsdelivr.net/gh/chenjialin1016/[email protected]/blog_files/img/PicGo_Github-PicBed/27A24F83-16F8-4B9D-A0BE-D31867163D1D.png

每次上传后,都需要配置release,才可以使用cdn访问

猜你喜欢

转载自blog.csdn.net/lin1109221208/article/details/106816862