![](/img/trans.png)
[英]Permission denied: Shared volume write and Read failing on Github Actions
[英]GitHub Actions workflow error: Permission denied
我正在运行 GitHub 操作工作流,但由于以下错误而失败。
Unhandled exception:
FileSystemException: Cannot create file, path = '/github/home/.flutter' (OS Error: Permission denied, errno = 13)
我查看了 GitHub Actions 的工作流语法,但找不到任何说明来解决这个问题。
我的构建文件如下所示:
name: Flutter CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
container:
image: cirrusci/flutter:v1.7.8-hotfix.4
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: flutter pub get
working-directory: my_app
- name: Run tests
run: flutter test
终于有时间查看它并添加sudo
解决了它。
该图像与用户cirrus
一起运行。 还需要提供完整路径:
sudo /home/cirrus/sdks/flutter/bin/flutter pub get
来自GitHub docs :
Linux和macOS虚拟机均使用无密码sudo运行。 当您需要执行命令或安装需要比当前用户更多特权的工具时,可以使用sudo而不需要提供密码。
除了将 sudo 添加到所有失败的步骤之外,您还可以只修改容器配置:
container:
image: cirrusci/flutter:v1.7.8-hotfix.4
options: --user root
说明:该问题是由于 cirrusci/flutter:v1.7.8-hotfix.4 映像上的默认用户无权访问由 github 挂载到此 docker 映像中的某些目录而引起的。 包括给您带来麻烦的/github
目录。 添加options: --user root
user options: --user root
到容器配置可确保默认用户成为 root,这样您就无需在每一步都执行 sudo。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.