Git Clone From Redirect Shorten Url

- 1 answer

Following up from Git & redirections

I want to shorten my super long github gist http clone url with bitly (or any other url shorter), but I'm always getting repository not found. Is there any workaround for it please?

Basically, I know I need to make use of http.followRedirects, for my links to my github url.
I did git config --global http.followRedirects true before doing git clone but
I'm still getting repository not found.



This is explored in the Reddit thread "Does git-clone support http redirects?" and the author found that TinyURL works:

My understanding is that git clone should follow the redirect if httpfollowRedirects is not false. Actually, the URLs that end with .git give 301, as well as old URLs of repos that have been renamed. Not sure why shortened URLs don't work then. Because they reply 302 rather than 301?

Okay looks like it's indeed the case! I tried again with tinyurl which uses 301 instead 302 and it worked.

Both bitly and use 302. is created specifically for github URLs but the URLs it creates don't work with git