【发布时间】:2022-11-10 02:38:09
【问题描述】:
我正在尝试更新运行我公司某些站点的一些非生产版本的本地服务器,以便在主存储库合并拉取请求时进行更新。但是,当操作到达git pul ... 行时,操作会停止。日志不提供任何信息,该过程似乎停止了。我可以在命令提示符下运行相同的命令。任何建议表示赞赏。
主要的.yml
name: CI
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
deployment:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Test
shell: cmd
run: actions.cmd
动作.cmd
cd path\to\stuff
git pull remoteName master
更新,遇到了一些奇怪的缓存问题,但能够清理一下并收到一些错误消息:
nothing to commit, working tree clean
fatal: 'github' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
success
Error: Process completed with exit code 1.
github 是远程的名称。同样,我可以正常运行这些脚本,但也许工作流程需要一些额外的身份验证?
【问题讨论】:
-
据我所知,当您使用
actions/checkout@v2时,您不必从远程仓库中提取。 -
请记住,pull = fetch + 2nd-command-of-your-choice。在脚本中,避免使用更冗长的两个命令序列,以便完全控制并提高调试能力。在这种情况下,获取步骤失败:GitHub 用于运行此操作的克隆没有名为
github的远程。大概你需要一个git remote add步骤,尽管 GitHub 使用的克隆是从首先是 GitHub 克隆,所以这看起来有点奇怪。 -
如果你别需要 fetch 步骤(如果您进行完整克隆,则不会;请记住,
checkout@v2默认情况下会进行浅层单分支克隆),您只需运行第二直接执行step命令。这很可能是要走的路。
标签: git github-actions git-pull github-actions-self-hosted-runners