基本上,我有一个Lektor项目,我正在try 使用Github Actions来部署到Github Pages

But发布总是失败,并显示此消息fatal: could not read Username for 'https://github.com': No such device or address

以下是完整的日志(log):

Run lektor deploy ghpages-https
/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/lektor/publisher.py:657: DeprecationWarning: 'werkzeug.urls.url_parse' is deprecated and will be removed in Werkzeug 3.0. Use 'urllib.parse.urlsplit' instead.
  url = urls.url_parse(str(target))
/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/werkzeug/urls.py:545: DeprecationWarning: 'werkzeug.urls.URL' is deprecated and will be removed in Werkzeug 3.0. Use the 'urllib.parse' library instead.
  return result_type(scheme, netloc, url, query, fragment)
Deploying to ghpages-https
  Build cache: /home/runner/.cache/lektor/builds/1e169503b08805b6925804c56b34ca69
  Target: ghpages+https://dzc0d3r/codeblog
  hint: Using 'master' as the name for the initial branch. This default branch name
  hint: is subject to change. To configure the initial branch name to use in all
  hint: of your new repositories, which will suppress this warning, call:
  hint:
  hint:     git config --global init.defaultBranch <name>
  hint:
  hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
  hint: 'development'. The just-created branch can be renamed via this command:
  hint:
  hint:     git branch -m <name>
  Initialized empty Git repository in /home/runner/work/codeblog/codeblog/temp/.deploytempbbbozlcm/scratch/.git/
  From https://github.com/dzc0d3r/codeblog
   * [new branch]      gh-pages   -> origin/gh-pages
/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/werkzeug/urls.py:170: DeprecationWarning: 'werkzeug.urls.url_decode' is deprecated and will be removed in Werkzeug 2.4. Use 'urllib.parse.parse_qs' instead.
  return url_decode(self.query, *args, **kwargs)
  fatal: could not read Username for 'https://github.com': No such device or address
Done!

publish.yml文件:

name: Publish
on:
  push:
    branches:
      - main


jobs:
  publish:
    name: Publish site
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: "3.X"
    - uses: actions/cache@v2
      with:
        key: ${{ github.ref }}
        path: .cache
    - name: Install dependencies
      run: |
        pip install --upgrade pip
        pip install --upgrade setuptools
        pip install -r requirements.txt
    - name: Build site
      run: |
        lektor plugins reinstall
        lektor build --no-prune


    - name: Publish site
      env:
        LEKTOR_DEPLOY_USERNAME: ${{ secrets.LEKTOR_DEPLOY_USERNAME }}
        LEKTOR_DEPLOY_PASSWORD: ${{ secrets.LEKTOR_DEPLOY_PASSWORD }}
      run: |
        lektor deploy ghpages-https

这是前codeblog.lektorproject名:

[project]
name = codeblog
url = https://dzc0d3r.github.io/codeblog/

[servers.ghpages]
target = ghpages://dzc0d3r/codeblog

[servers.ghpages-https]
target = ghpages+https://dzc0d3r/codeblog

[packages]
lektor-minify = 1.2
lektor-disqus-comments = 0.4.1
lektor-tags = 0.3

任何 idea 、帮助、循序渐进的指导都将不胜感激

推荐答案

你们有2FA的吗?lektor documentation表示,如果您启用了双因素身份验证,则在使用HTTPS时需要personal access token而不是普通的用户名和密码.

如果我没记错的话,lektor website本身是用Lektor构建的,托管在GitHub页面上,并部署了GitHub操作,所以你可以看看他们的workflow.lektorproject文件来获得一些灵感.

在他们的工作流程中,他们使用GITHUB_TOKEN secret作为个人访问令牌进行身份验证.出于身份验证目的,在每个操作工作流中都会自动创建该密码,并且可以使用${{ secrets.GITHUB_TOKEN }}访问该密码

Python相关问答推荐

在Pandas框架中截短至固定数量的列

理解Python的二分库:澄清bisect_left的使用

使用SciPy进行曲线匹配未能给出正确的匹配

TARete错误:类型对象任务没有属性模型'

Deliveryter Notebook -无法在for循环中更新matplotlib情节(保留之前的情节),也无法使用动画子功能对情节进行动画

根据在同一数据框中的查找向数据框添加值

为什么我的Python代码在if-else声明中的行之前执行if-else声明中的行?

try 在树叶 map 上应用覆盖磁贴

scikit-learn导入无法导入名称METRIC_MAPPING64'

多处理队列在与Forking http.server一起使用时随机跳过项目

如何在BeautifulSoup/CSS Select 器中处理regex?

使用Openpyxl从Excel中的折线图更改图表样式

使用Python异步地持久跟踪用户输入

使用嵌套对象字段的Qdrant过滤

裁剪数字.nd数组引发-ValueError:无法将空图像写入JPEG

如何使用加速广播主进程张量?

来自Airflow Connection的额外参数

如果不使用. to_list()[0],我如何从一个pandas DataFrame中获取一个值?

如何将一个文件的多列导入到Python中的同一数组中?

替换包含Python DataFrame中的值的<;