Richard14
V2EX  ›  问与答

github 私有仓库有办法设置 token 访问吗?

  •  
  •   Richard14 · Apr 29, 2022 · 4613 views
    This topic created in 1651 days ago, the information mentioned may be changed or developed.

    经常有需要在一些服务器上拉取私有仓库的代码(然后做部署),但是我目前只会在机器上登录账号然后拉取,感觉非常不爽。有什么办法例如生成一个 token 之类的,持有此 token 可以访问仓库,之类的吗?

    8 replies  •  2022-04-30 09:55:22 +08:00
    Richard14
    Richard14
    OP
    Apr 29, 2022
    3
    @arischow 谢谢,你这个我试了不好使,但是改了个格式好使了

    $ git clone https://<TOKEN>@github.com/username/repo.git

    我用的这个格式
    arischow
    arischow
    Apr 29, 2022
    4
    @Richard14 #3

    那应该是我记错了,抱歉!!
    FrankAdler
    FrankAdler
    Apr 29, 2022 via iPhone
    5
    在个人设置里创建 token 可以通过 api 获取内容: https://api.github.com/repos/OWNER/REPO/contents/PATH 返回文件内容和一次性下载地址( raw 地址)
    不过 token 不是项目专用,是可以访问所有私有仓库
    Nnq
    Nnq
    Apr 30, 2022
    6
    token 是跟自己账户走的吧
    Kobayashi
    Kobayashi
    Apr 30, 2022 via Android
    7
    SSH 转发不好吗?
    univ
    univ
    Apr 30, 2022
    8
    可以通过 token 可以访问私有 raw 吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2479 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:00 · PVG 23:00 · LAX 07:00 · JFK 10:00
    ♥ Do have faith in what you're doing.