https://raw.githubusercontent.com/[user]/repo/path/file
这个格式的网址是长久可以访问的。
https://raw.githubusercontent.com/[user]/repo/path/file?token=xxxxxxxxxxxxxxxxx
这个是临时访问网址,过一会就不能访问了。
然后在网上找了一些格式,也不能访问,测试格式如下:
https://raw.githubusercontent.com/[user]/repo/path/file?token=OAUTH-TOKEN
https://[email protected]/[user]/repo/path/file
https://rawgit.com/[user]/repo/path/file?token=OAUTH-TOKEN
https://api.github.com/[user]/repo/path/file?access_token=OAUTH-TOKEN
https://api.github.com/[user]/repo/path/file?client_id=MY-CLIENT-ID&client_secret=MY-CLIENT-SECRET
如何像公开库一样( HTTP 方式),实现长久访问私有库的 raw 格式文件,请大佬赐教,或给个解决方法的链接。
谢谢!
谢谢各位回答。
本题需要的是:用浏览器就可以查看 GitHub 私有库文件 raw 格式的命令(不是命令行等方式)。
对于各位回答,我会一个一个测试,如果成功,会写出答案。
再次感谢!
![]() |
1
littleylv 2019-10-22 17:37:47 +08:00 ![]() |
![]() |
2
ETiV 2019-10-22 17:57:15 +08:00 via iPhone
GitHub 貌似支持 http basic auth 的样子
生成一个 personal access token 访问用 https://[user]:[token]@github.com/blahblah 这种 URL,后面没有 query 参数 |
![]() |
3
learnshare 2019-10-22 18:39:45 +08:00
|
![]() |
4
weioyi OP @learnshare 这个是用于公有库的。我需要的是用于私有库的。
|
![]() |
5
dorentus 2019-10-23 01:16:02 +08:00 via iPhone
用付费的 private repo 开 pages 提供 URL。
|
6
quicysver 2019-11-18 14:29:07 +08:00
我最近也发现这个问题 不知道怎么解决
|
8
uniconhlp 2019-11-21 21:38:46 +08:00
@weioyi Github 的 api 还没研究,不过目前 gitlab 的私有库查看 raw 文件格式倒是 OK 了: https://gitlab.com/api/v4/projects/:id/repository/files/yyyyy%2Fxxxxxx.conf/raw?ref=master&private_token=xxxxxxxxxxx
exp:查看仓库 id:id 下的 yyyyy 目录中的 xxxxxx.conf 源文件。ref=master 必须选择分支。private_token 同 GitHub 一样申请。希望有用。 |
9
Levox 2020-04-04 12:52:48 +08:00
楼主解决了吗?
|
10
KhaosChow 2020-06-26 22:47:34 +08:00 via Android
有人解决了吗?
|
![]() |
11
o0OoO0o 2020-11-28 18:02:14 +08:00
同问,最后解决了吗?
|
13
mjollnir 2020-12-31 16:41:32 +08:00
我测试下来这种方法可行
curl https://[username]:[token]@raw.githubusercontent.com/[username]/[repo]/master/[xxxxxxx] |
![]() |
14
weioyi OP |
15
Token3 2021-02-20 16:19:11 +08:00
最近也遇到了这个问题,楼主最终解决这个问题了吗?
|
17
jfgyjghrjry 164 天前
创建 oauth 令牌,raw 链接+?access_token=oauth 令牌即可
|
18
jfgyjghrjry 164 天前
@jfgyjghrjry 刚刚试了一下,好像不可以了🤦♂️
|
![]() |
19
sunny2580839896 64 天前
解决了吗?
|