Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 4

Permission denied to create file in "/github/home/" folder

Solved! Go to Solution.

I have this simple workflow to build a Flutter app, but it is failing to create a file at the home /github/home/ folder.

 

Run flutter pub get

FileSystemException: Cannot create file, path = '/github/home/.flutter' (OS Error: Permission denied, errno = 13)
#0      _File.throwIfError (dart:io/file_impl.dart:643:7)
#1      _File.createSync (dart:io/file_impl.dart:281:5)

I attached the container initialization log and it is possible to see that the docker image has the home volume mapped to it.

 

name: Dart 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
      working-directory: my_app

Here are the logs for this action.

 

https://github.com/actions/docker/files/3587247/initialize-containers.log

https://github.com/actions/docker/files/3587248/install-dependencies.log

3 Replies
GitHub Staff
Message 2 of 4

Re: Permission denied to create file in "/github/home/" folder

I'm not familiar with the `cirrusci/flutter` container.  What user is that running as?  You may need to run some commands in that container as root.

Copilot Lvl 3
Message 3 of 4

Re: Permission denied to create file in "/github/home/" folder

`flutter pub get` will create `~/.pub-cache`

It works on Gitlab CI with the same image, but doesn't on GitHub Action

Solution
Copilot Lvl 2
Message 4 of 4

Re: Permission denied to create file in "/github/home/" folder

Solved it by adding "sudo" before any command that requires permission. It also requires that the full path of Flutter is referenced when executing the commands.

 

The image was running with "cirrus" user and therefore didn't have permission.

 

More info here: https://stackoverflow.com/a/58469603/3231778