【问题标题】:What does this sha number in the git path of a gem in a Gemfile mean?Gemfile 中 gem 的 git 路径中的这个 sha 数字是什么意思?
【发布时间】:2015-12-15 17:59:20
【问题描述】:

我在下面的 Gemfile 中看到以下内容。

“5343434343424324b5:x-oauth-basic@github.com”是什么意思?它是一个commit sha吗?然后我如何找到它所在的分支?我已经尝试查看带有标签 1.22.0

的任何内容
gem 'company-gem', git: 'https://5343434343424324b5:x-oauth-basic@github.com/CompanyName/company-gem.git', tag: '1.22.0', require: 'company-gem/core'

【问题讨论】:

    标签: ruby-on-rails git gemfile


    【解决方案1】:

    这是一个 OAuth 网址,a feature introduced by GitHub in 2012

    5343434343424324b5 是 OAuth 令牌:

    如果您在脚本中进行克隆并且需要避开提示,您可以 可以将令牌添加到克隆 URL:

    git 克隆https://token@github.com/owner/repo.git

    警告:出于安全原因,GitHub 警告不要将令牌嵌入 url:

    注意:令牌应被视为密码。将令牌放入 克隆 URL 将导致 Git 将其写入 .git/config 文件中 纯文本

    更多信息:https://developer.github.com/v3/oauth/

    【讨论】:

      【解决方案2】:

      这是身份验证信息。通常,URL 可以采用“protocol://username@password:hostname/path”的形式。在这种情况下,“5343434343424324b5”是用户名部分,“x-oauth-basic”是密码部分,但看起来服务器端应用程序将“5343434343424324b5”视为某种 OAuth 令牌。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-08-10
        • 2020-03-18
        • 1970-01-01
        • 2023-04-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-08-07
        相关资源
        最近更新 更多