Skip to content

Instantly share code, notes, and snippets.

@espoelstra
Forked from dikiaap/git-io-custom-url.md
Created May 14, 2020 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save espoelstra/3ee4584f157ab9be5a1310253923b3ac to your computer and use it in GitHub Desktop.
Save espoelstra/3ee4584f157ab9be5a1310253923b3ac to your computer and use it in GitHub Desktop.
git.io custom URL

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 ? at the end in your GitHub URL.

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

If you want to revoke your custom name, you should contact GitHub Support Team.

@espoelstra
Copy link
Author

Note that once you've created a URL it is essentially "stuck", so you don't want to create git.io/mycustomname with a URL tied to a specific commit, because any future commits won't be reflected when users access your URL. You'll want to use a floating reference like master or similar and if using a /raw/ URL make sure you use a version not tied to a specific commit, in the case of a Gist you can do this by dropping the commit ID between the /raw/ and the filename in the Gist you want users to be able to access easily.

Eg, the RAW for this gist at the time of this comment is https://gist.github.com/espoelstra/3ee4584f157ab9be5a1310253923b3ac/raw/087af548553863a44c855f6d62402812148449e8/git-io-custom-url.md but if I drop the 087af548553863a44c855f6d62402812148449e8 and make a git.io URL then as I make changes to the Gist even if I force pushed to replace all the history, as long as the Gist's ID didn't change this URL, https://gist.github.com/espoelstra/3ee4584f157ab9be5a1310253923b3ac/raw/git-io-custom-url.md should always point to the specific markdown file.

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