Skip to content

Instantly share code, notes, and snippets.

@dikiaap
Last active May 7, 2024 17:34
Show Gist options
  • Save dikiaap/01f5e2ba3c738012aef0a8f524a6e207 to your computer and use it in GitHub Desktop.
Save dikiaap/01f5e2ba3c738012aef0a8f524a6e207 to your computer and use it in GitHub Desktop.
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

@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