简体   繁体   中英

Encrypting a file on Travis for a GitHub repo that was renamed

I am attempting to encrypt a file for use on Travis-CI, as I have successfully done before. However, at some point the associated GitHub repository was renamed. I now suspect -- but cannot confirm -- that the renaming occurred after I last successfully added an encrypted file.

The affected file contains an OAuth2 token that needs to be refreshed every several months, which is my current need. Without this, my tests don't run.

When I follow the directions here , I can successfully login to Travis, see my repos, etc, but I cannot encrypt a file for this repo. I used this instructions successfully when I created the encrypted file the first time.

Here's what happens:

$ travis encrypt-file tests/testthat/googlesheets_token.rds 
repository not known to https://api.travis-ci.com/: jennybc/gspreadr

The repository in question is https://github.com/jennybc/googlesheets but was renamed several months ago from gspread to googlesheets. At the time, this appeared to go well. I cannot find any evidence of the old repo name in GitHub or in my Travis account, so I can't figure out how to get around this error. Where is Travis digging up this old info to choke on?

I found the answer in this issue thread . You need to look in .git/config and update the travis slug.

[travis]
slug = jennybc/MAKE_SURE_THIS_REFLECTS_CURRENT_REPO_NAME

Apparently this is NOT automatically updated when you rename a GitHub repo.

Funny thing, I also renamed my repository but the slug name seemed right and running travis init would point me to the same name.

Only problem was that Travis would rename my name with all lowercase while in GitHub my name had two upper cases. So I renamed my name to equal exactly the one in GitHub and then Travis found my repository, hurray!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM