Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Actions workflow error: Permission denied

Tags:

I'm running a GitHub Actions workflow and it is failing with the following error.

Unhandled exception:
FileSystemException: Cannot create file, path = '/github/home/.flutter' (OS Error: Permission denied, errno = 13)

I looked in Workflow syntax for GitHub Actions but couldn't find any instruction to solve this.

My build file is looking like this:

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
like image 245
Evandro Pomatti Avatar asked Sep 07 '19 03:09

Evandro Pomatti


People also ask

How do I fix git permission denied error?

Always use the "git" user $ ssh -T [email protected] > Permission denied (publickey). If your connection failed and you're using a remote URL with your GitHub username, you can change the remote URL to use the "git" user. You should verify your connection by typing: $ ssh -T [email protected] > Hi USERNAME!

Can I push permission to denied GitHub?

This error means the key you are pushing with is attached to another repository as a deploy key, and does not have access to the repository you are trying to push to. To fix this, remove the deploy key from the repository, and add the key to your personal account instead.

What is GitHub actions workflow?

GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository, or deploy merged pull requests to production.


1 Answers

Finally got the time to look at it and adding sudo solved it.

The image runs with user cirrus. It is also required to provide the full path:

sudo /home/cirrus/sdks/flutter/bin/flutter pub get

From GitHub docs:

The Linux and macOS virtual machines both run using passwordless sudo. When you need to execute commands or install tools that require more privileges than the current user, you can use sudo without needing to provide a password.

like image 188
Evandro Pomatti Avatar answered Sep 26 '22 09:09

Evandro Pomatti