安装 gem 失败,认证未通过。

3

运行bundle install时出现错误:

Fetching https://x-oauth-basic@github.com/MyCompanny/fiscal_calendar.git
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/MyCompanny/fiscal_calendar.git/'
Retrying `git clone 'https://x-oauth-basic@github.com/MyCompanny/fiscal_calendar.git' 

虽然在Gemfile中声明了,但它最终会失败。

pat = "OUR PERSONAL TOKEN HERE"
gem 'fiscal_calendar', '~> 0.1.2', git: "https://#{pat}:x-oauth-basic@github.com/MyCompanny/fiscal_calendar.git"

我们确信我们的个人令牌是有效的,但我们仍然收到错误消息“用户名或密码无效”。
虽然在日志中它说:
git clone 'https://x-oauth-basic@github.com/MyCompanny/fiscal_calendar.git'

所以,看起来没有使用个人令牌?

有什么想法吗?


1
密码/用户名/令牌不应该放在gemfile中 - 可以使用bundle config 在带外设置它们。请参阅https://bundler.io/v1.15/bundle_config.html上的“Gem源凭据”部分。 - fredrik
@fredrik 我使用了这个代码``` 但仍然遇到同样的问题,一直要求输入密码。 - eftikhar
你是要使用实际的令牌还是这里发布的确切字符串? - fredrik
这是一段与编程有关的内容,大意为:最近两天出现了一个问题,正在尝试解决。简单来说,Bundler读取了PAT(Personal Access Token),但仍然在要求输入密码。 - eftikhar
1个回答

0
经过调查,发现Github个人令牌已过期。似乎我的令牌过期测试没有起作用,因为宝石实际上被缓存了。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接