首页 > 解决方案 > Travis CI 的 PyPi 部署:身份验证无效或不存在

问题描述

通过 Travis CI 部署到 PyPi 时,出现以下错误:

HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/

我已经按照 Travis CI 文档进行pypi 部署,并设置了我的 PyPI 用户名和密码,后者根据密码加密文档进行了加密。密码没有任何值得转义的字符,但无论如何我都尝试转义所有字符。

似乎没什么用,有什么建议吗?

Travis CI 配置的相关部分是:

- provider: pypi
  on:
    branch: master
    tags: true
  user: "<<username>>"
  password:
    secure: "<<encrypted password>>"
  distributions: "sdist bdist_wheel"
  skip_existing: true

编辑

在 Travis 运行之前preparing deploydeploying the application它似乎已成功验证。然而,当它完成上传时,它会引发 403 invalid auth 错误:

Installing deploy dependencies
...
Authenticated as <<username>>
Preparing deploy
...
Deploying application
...
Uploading distributions to https://upload.pypi.org/legacy/
Uploading example-package-py3-none-any.whl
100%|██████████| 41.0k/41.0k [00:00<00:00, 90.3kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/

标签: piptravis-cipypi

解决方案


在联系travis-ci支持人员后,他们注意到存储库首先存在travis-ci.orgtravis-ci.com. 这为身份验证带来了问题。

解决方案是明确travis encrypt运行travis-ci.com

travis encrypt <<password>> --com --debug

调试标志显然是可选的,并在终端中提供了一些附加信息。


推荐阅读