0

我最近在 GitHub 上更改了我的个人访问令牌,我想我已经把新令牌放在了所有正确的地方......但也许我错过了一个地方?

问题:

$ git push staging my_cool_branch:master
...
...
...
remote: -----> Installing dependencies using bundler 2.2.33
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        Fetching gem metadata from https://rubygems.org/.......
remote:        Fetching gem metadata from https://rubygems.pkg.github.com/private_org/.
remote:        
remote:        
remote:        Bad username or password for https://bart_simpson@rubygems.pkg.github.com/private_org/.
remote:        Please double-check your credentials and correct them.
remote:        Bundler Output: Fetching gem metadata from https://rubygems.org/.......
remote:        Fetching gem metadata from https://rubygems.pkg.github.com/private_org/.
remote:        
remote:        
remote:        Bad username or password for https://bart_simpson@rubygems.pkg.github.com/private_org/.
remote:        Please double-check your credentials and correct them.
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
...
...
...

带有个人访问令牌的文件(我知道):

$ cat ~/.bundle/config 
---
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: "bart_simpson:ghp_nJabIP9JjPe7KOwgDrkiJextJggm114MZh7f"
BUNDLE_HTTPS://RUBYGEMS__PKG__GITHUB__COM/PRIVATE_ORG/: "bart_simpson:ghp_nJabIP9JjPe7KOwgDrkiJextJggm114MZh7f"

$ cat ~/.gem/credentials
---
:github: Bearer ghp_nJabIP9JjPe7KOwgDrkiJextJggm114MZh7f

$ cat ~/.gemrc 
---
:backtrace: false
:bulk_threshold: 1000
:sources:
- https://rubygems.org/
- https://bart_simpson:ghp_nJabIP9JjPe7KOwgDrkiJextJggm114MZh7f@rubygems.pkg.github.com/private_org/
:update_sources: true
:verbose: true
4

1 回答 1

0

啊,看到~/.bundle/config上面了吗?

解决方案是我还必须在以下位置设置BUNDLE_RUBYGEMS__PKG__GITHUB__COM新令牌staging

heroku config:set BUNDLE_RUBYGEMS__PKG__GITHUB__COM=bart_simpson:ghp_nJabIP9JjPe7KOwgDrkiJextJggm114MZh7f

...顺便说一句,这意味着您还必须将其设置为.env

BUNDLE_RUBYGEMS__PKG__GITHUB__COM=bart_simpson:ghp_nJabIP9JjPe7KOwgDrkiJextJggm114MZh7f
BUNDLE_GITHUB__COM=x-access-token:ghp_nJabIP9JjPe7KOwgDrkiJextJggm114MZh7f
于 2022-01-07T21:06:57.470 回答