GitHub原始网址是否过期?

时间:2016-06-30 20:43:31

标签: github

私有存储库的GitHub原始URL是否会过期?我指的是在github.com上查看文件时单击<bean class="org.apache.ignite.configuration.IgniteConfiguration"> <property name="marshaller"> <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller"/> </property> </bean> 按钮时生成的链接。

该链接包含一个令牌,但没有关于该令牌来自何处的信息。

3 个答案:

答案 0 :(得分:2)

请查看此API文档https://developer.github.com/v3/repos/contents/

URL应为:

curl -H 'Accept: application/vnd.github.VERSION.raw' -k \
https://{{githubhost}}/api/v3/repos/{{org}}/{{repo}}/contents/{{path}}?access_token=xxxx

对我有用:

  • access_token是个人访问令牌。
  • 路径可以是文件或目录。

答案 1 :(得分:0)

该令牌来自using OAuth with Git

https://<oauth-secret>:x-oauth-basic@raw.githubusercontent.com/<me>/<repo>/master/<file>

raw.githubusercontent.com/<me>/<repo>/master/<file>部分未过期 但是在点击GitHub页面上的' Raw '之前键入' y ',以便将SHA1作为url的一部分:这样,你确定始终引用相同的文件版本。

https://<oauth-secret>:x-oauth-basic@raw.githubusercontent.com/<me>/<repo>/<sha1>/<file>
                              ^                                             ^^^^

token part does not "expire"(但可以删除或撤消)

答案 2 :(得分:0)

除了github raw urls expire in 7 days之外,没有人明确提到这一点。

您可以使用在以下位置生成的更持久的个人访问令牌https://github.com/settings/tokens,但只能通过curl使用:

rawValue

请注意,如果个人访问令牌在整整一年内都未使用,则会失效。