Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git.io custom URL

Update: As of 11 January 2022, git.io no longer accepts new URLs.

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
  • https://*.github.io/*
  • https://*.githubusercontent.com/*

If you accidentally make a typo in the custom name, you can add .git (only the repository name) or ? at the end in your GitHub URL.

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL.git" -F "code=YOUR_CUSTOM_NAME"
curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL?" -F "code=YOUR_CUSTOM_NAME"

Shortcut to this Gist: git.io/customurl

@alekssamos
Copy link

alekssamos commented Aug 14, 2019


Connecting to git.io[54.152.127.232]:443... connected.

Unable to establish SSL connection.

Unable to establish SSL connection.

@FranklinYu
Copy link

FranklinYu commented Aug 25, 2019

Note that a long link can only be mapped to one short link.

@koumaza
Copy link

koumaza commented Jun 8, 2020

There is also such a method.
Add .git after the URI.

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL.git" -F "code=YOUR_CUSTOM_NAME"

@dikiaap
Copy link
Author

dikiaap commented Jun 9, 2020

@koumaza Good catch! I have updated the Gist.

@steinbrueckri
Copy link

steinbrueckri commented Jun 12, 2020

❤️

@yamiacat
Copy link

yamiacat commented Sep 25, 2020

Please note that as of Sep 2020 GitHub Support is no longer releasing git.io URLs:

https://github.blog/changelog/2020-09-23-git-io-urls-no-longer-released-by-github-support/

@MxShift
Copy link

MxShift commented Nov 30, 2020

Is this feature still working? For some reason, I couldn't create a link with my custom name, it just gave a regular JkjAa link.

UPD: I get it, just a short version of this link has already been created.

@Madhushanudeshike
Copy link

Madhushanudeshike commented Dec 16, 2020

@rokibhasansagar
Copy link

rokibhasansagar commented Dec 24, 2020

Custom naming still works. 🤟
I tried shortening a gist of mine with two separate short code, sadly only first one works.

@trinib
Copy link

trinib commented Mar 29, 2021

ok thank you very much

@perlun
Copy link

perlun commented May 20, 2021

UPD: I get it, just a short version of this link has already been created.

If this happens to you (it just did to me...), use the .git hack suggested by @dikiaap in the original gist:

If you accidentally make a typo in the custom name, you can add .git (only the repository name) or ? at the end in your GitHub URL.

@romandobra
Copy link

romandobra commented May 22, 2021

user@debian:~$ curl https://git.io/ -i -F "url=https://raw.githubusercontent.com/undecoded/wgetqo/main/install/node12" -F "code=wgetqo/node"
HTTP/1.1 201 Created
...
Location: https://git.io/wgetqo/node
...

user@debian:~$ wget git.io/wgetqo/node
...
2021-05-22 21:48:49 ERROR 404: Not Found.

Why?

@jemadux
Copy link

jemadux commented Jul 2, 2021

i

Note that a long link can only be mapped to one short link.

i didnt do it custom.... ..

@v1s1t0r999
Copy link

v1s1t0r999 commented Jul 26, 2021

Those Who all are trying to shorten their USERNAME.github.io/REPO link, If y'all face any errors,

  1. Then don't do the .git hack suggested by @koumaza here.

  2. Change your repo name a bit, and then try the same thing.

$ curl https://git.io/ -i -F "url=https://USERNAME.github.io/NEW_REPO_NAME" -F "code=CUSTOM_NAME"

@pavi2410
Copy link

pavi2410 commented Aug 10, 2021

I created an alias in gh cli like so

> gh alias set --shell gitio 'curl.exe https://git.io/ -i -F "url=$1" -F "code=$2"'

Note: On Linux, replace curl.exe with curl

Use it as shown below

> gh gitio https://gist.github.com/4b6201bd19e5f5cc0349492af0b8ee28 tcp_echo_server_client
HTTP/1.1 201 Created
Server: Cowboy
Connection: keep-alive
Date: Tue, 10 Aug 2021 12:40:59 GMT
Status: 201 Created
Content-Type: text/html;charset=utf-8
Location: https://git.io/tcp_echo_server_client
Content-Length: 56
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Runtime: 0.006904
X-Node: 80a0b9ab-c56e-4039-a069-24e6cc1404c6
X-Revision: 392798d237fc1aa5cd55cada10d2945773e741a8
Strict-Transport-Security: max-age=31536000; includeSubDomains
Via: 1.1 vegur

https://gist.github.com/4b6201bd19e5f5cc0349492af0b8ee28

@nskobelevs
Copy link

nskobelevs commented Sep 1, 2021

Lovely stuff!

Although git.io/customrul doesn't work anymore :(

Redirects to https://gist.github.com/dikiaap/01f5e2ba3c738012aef0a8f524a6e207%5C#file-git-io-custom-url-md but with a Page Not Found.

Doesn't seem to like the backslash (%5C) as removing that works grand.

Made www.git.io/custom-url as a fix!

@asheroto
Copy link

asheroto commented Oct 20, 2021

Apparently you can't visit the shortened URL before you create it. If you do, it may not work.

I created a custom shortened URL but visited the URL first, and even after creating it, it said "no url found". Thought it might just be a cached/cdn issue, so waited a few days. It still didn't work after a few days.

Ended up just added a ? to fix.

@hosamn
Copy link

hosamn commented Feb 2, 2022

Update: As of 11 January 2022, git.io no longer accepts new URLs.
Any Idea why they did this?
the blog post gives no explations at all :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment