從Git 和重定向跟進
我想用 bitly(或任何其他更短的 url)縮短我的超長 github gist http clone url,但我總是得到repository not found. 請問有什么解決方法嗎?
基本上,我知道我需要使用http.followRedirects, 來獲取指向我的 github url 的 bit.ly 鏈接。
我git config --global http.followRedirects true之前做過git clone,但
我仍然得到repository not found。
uj5u.com熱心網友回復:
這在 Reddit 主題“Does git-clone support http redirects?”中進行了探討。作者發現TinyURL有效:
我的理解是,如果不是假的,
git clone應該遵循重定向。httpfollowRedirects實際上,以 301 結尾的 URL,.git以及已重命名的 repos 的舊 URL。不知道為什么縮短的 URL 不起作用。因為他們回復的是 302 而不是 301?好吧看起來確實如此!我再次嘗試使用使用 301 而不是 302 的 tinyurl 并且它有效。
bitly 和 git.io 都使用 302。 git.io 是專門為 github URL 創建的,但它創建的 URL 不適用于 git
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/426182.html
