Git.io 是GitHub 站内链接的短网址服务,可以直接在网页上生成短链接,也可以用通过命令端完成。
下面是自定义方式
自定义短链代码示例:
curl -i https://git.io -F "url=https://github.com/5iux/youhua/raw/master/youhua.user.js" -F "code=youhua"
格式为:
curl -i https://git.io -F "url=想要被缩短的网址" -F "code=自定义数值"
终端运行后:
curl -i https://git.io -F "url=https://github.com/5iux/youhua/raw/master/youhua.user.js" -F "code=youhua"
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Cowboy
Connection: keep-alive
Date: Tue, 06 Aug 2019 03:10:35 GMT
Status: 201 Created
Content-Type: text/html;charset=utf-8
Location: https://git.io/youhua
Content-Length: 56
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Runtime: 0.288247
X-Node: 3ba095ff-edc9-4674-bb92-0ade15288e9e
X-Revision: 392798d237fc1aa5cd55cada10d2945773e741a8
Strict-Transport-Security: max-age=31536000; includeSubDomains
Via: 1.1 vegur
https://github.com/5iux/youhua/raw/master/youhua.user.js
生成的短链为:
https://git.io/youhua