【问题标题】:Workflow error working directory has unstaged changes工作流错误工作目录有未暂存的更改
【发布时间】:2022-07-15 22:46:10
【问题描述】:

每当我尝试推送/合并更改时,GitHub 中的工作流都会失败并显示“工作目录有未暂存的更改”的错误; 提交后,它要求我推送更改;推送后,我在 github 网站上收到错误通知;



以下是工作流 .github/workflows/dev-deploy.yml 中的代码。

      chmod 600 ~/.ssh/*
      git config --local core.sshCommand 'ssh -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes -o StrictHostKeyChecking=no'
      git remote add DEV "$DEV_REPO"
      git push DEV

以下是单击电子邮件“DEV Deploy:所有作业均失败”后可访问的输出。它实际上执行了一个工作流,或者在单击 GitHub 站点通知后,它会将我们带到工作流。如果我们点击构建,它会显示“工作目录有未暂存的更改”,



到目前为止我已经尝试过git push DEV;

rm -r *
git reset --hard
git read-tree --reset -u HEAD
git restore -- .

但似乎没有任何效果,如果有人可以帮助我,那就太好了。

【问题讨论】:

    标签: git github github-actions git-push unstage


    【解决方案1】:

    你可以试试:

    git read-tree --reset -u HEAD
    

    确保丢弃未合并的条目。

    或者:

    git restore -- .
    

    【讨论】:

    • 将 git read-tree --reset -u HEAD "$1" 添加到我的 dev-deploy.yml 后,出现以下错误;致命:不是有效的对象名称错误:进程已完成,退出代码为 128。
    • @AhmedSyed 您可以删除 $1 部分。
    • 我已经尝试删除它,但它仍然没有做任何事情,下面是输出; echo "Before reset" git read-tree --reset -u HEAD echo "After reset" git push DEV shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} Before reset After reset Warning: Permanently added '[18**' (ECDSA) to the list of known hosts. To ssh://18**/.repo/ ! [remote rejected] dev -> dev (Working directory has unstaged changes) error: failed to push some refs to 'ssh://18**/.repo/' Error: Process completed with exit code 1.
    • @AhmedSyed 好的,git restore 选项怎么样?
    • @AhmedSyed 好的,我提到它是因为stackoverflow.com/a/25050788/6309
    猜你喜欢
    • 1970-01-01
    • 2016-06-16
    • 1970-01-01
    • 2018-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-16
    相关资源
    最近更新 更多