Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义 GitHub 短网址服务 #22

Open
rainyear opened this issue Jan 28, 2016 · 3 comments
Open

自定义 GitHub 短网址服务 #22

rainyear opened this issue Jan 28, 2016 · 3 comments
Assignees
Labels

Comments

@rainyear
Copy link
Owner

Git.io 是 GitHub 站内链接的短网址服务,可以直接在网页上生成短链接,也可以用通过命令端完成,使用说明:Git.io: GitHub URL Shortener.

可以通过设定参数code=lo22来自定义短链接参数,如本页面:git.io/lo22

curl -i https://git.io -F url=https://github.com/rainyear/lolita/issues/22 -F code=lo22

HTTP/1.1 100 Continue

HTTP/1.1 201 Created

Location: https://git.io/lo22

放到脚本里:

#!/bin/bash
if [ -n "$2" ]; then
    curl -i https://git.io -F url=https://github.com/"$1" -F code="$2";
else
    curl -i http://git.io -F url=https://github.com/"$1";
fi

需要注意的是每个链接只能被缩短一次,想要选个特殊意义的链接(注意大小写敏感),要慎重,我选了几个:

  1. Blog - git.io/rainy
  2. 本repo - git.io/lolita
  3. Coodict - git.io/Coo
@yuanbohan
Copy link

👍

@rainyear rainyear added the Note label Jan 28, 2016
@handleft
Copy link

赞!

@rainyear rainyear self-assigned this Sep 8, 2017
@maboloshi
Copy link

貌似你的域名coodict.com 已经废了ヽ(ー_ー)ノ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants