Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GitHub上的原始URL不断变化_Github_Url_Hyperlink_Raw - Fatal编程技术网

GitHub上的原始URL不断变化

GitHub上的原始URL不断变化,github,url,hyperlink,raw,Github,Url,Hyperlink,Raw,我需要一个降价文件,以便能够参考我的存储库中的图表,并使链接在图表更新时保持有效。我发现右键单击“原始”按钮并复制链接时得到的url在这两种形式之间有所不同: https://github.com/user/repo/raw/branch/folder/file.png https://raw.github.com/user/repo/branch/folder/file.png 注意“原始”位置的变化 有人能解释一下发生了什么吗?这些URL中的一个是指向另一个的重定向,或者它们都位于指向第三

我需要一个降价文件,以便能够参考我的存储库中的图表,并使链接在图表更新时保持有效。我发现右键单击“原始”按钮并复制链接时得到的url在这两种形式之间有所不同:

https://github.com/user/repo/raw/branch/folder/file.png
https://raw.github.com/user/repo/branch/folder/file.png
注意“原始”位置的变化


有人能解释一下发生了什么吗?

这些URL中的一个是指向另一个的重定向,或者它们都位于指向第三个链接的重定向链中。在某些情况下,您的浏览器可能已经预取了一个,并且已经知道目的地,而在其他情况下则不知道

我会将其中一个带到命令行提示符,并将其发送到
curl-Lv
,然后查看最后一个命令的结尾。或者,您可以使用API来查询此对象的原始链接,无论它提供什么都应该是正确的

我会告诉你,后一个域名可能是不正确的;我怀疑正确的URL位于域
raw.githubusercontent.com
,但我会要求API确认