Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone from redirect shorten url

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 bit.ly 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.

like image 301
xpt Avatar asked Nov 23 '25 23:11

xpt


1 Answers

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 git.io use 302. git.io is created specifically for github URLs but the URLs it creates don't work with git

like image 126
fn control option Avatar answered Nov 26 '25 15:11

fn control option



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!