Skip to content

"Error: Error: Could not read from remote repository." with @v9 #450

Description

@vitalyk-multinarity

Describe the bug
"Error: Error: Could not read from remote repository" error using @v9

The same flow works with v7.5.0

Note: with checkout@v3 I'm using PAT instead of default token.

Similar to #199
Workflow used

 - name: Update  plugins  
      uses: EndBug/add-and-commit@v9
      with:
        add: 'my_path'
        message: 'CI: Updating control-*.aar [skip ci]'
        pull: 'NO-PULL'    

Expected behavior
git add / git commit / git push

Logs
Either provide a link to the action run or (if your repo is private) paste here the logs from the step that uses it. If you paste the logs, please use this template, and remember to paste the logs from all the different sections.

Logs
Run EndBug/add-and-commit@v9
  with:
    add: my-peth
    message: CI: Updating control*.aar [skip ci]
    pull: NO-PULL
    cwd: .
    default_author: github_actor
    fetch: --tags --force
    pathspec_error_handling: ignore
    push: true
    github_token: ***
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Zulu_jdk/8.0.35[2](https://github.com/multinarity/SpaceTop-Unity/actions/runs/3361537012/jobs/5572055054#step:12:2)-8/x64
    JAVA_HOME_8_X64: /opt/hostedtoolcache/Java_Zulu_jdk/8.0.[3](https://github.com/multinarity/SpaceTop-Unity/actions/runs/3361537012/jobs/5572055054#step:12:3)52-8/x6[4](https://github.com/multinarity/SpaceTop-Unity/actions/runs/3361537012/jobs/5572055054#step:12:4)
Running in /home/runner/work/my-repo/my-repo
Add input parsed as single string, running 1 git add command.
> Using 'vitalyk' as author.
> Using "CI: Updating control-*.aar [skip ci]" as commit message.
Internal logs
  > Staging files...
  > Adding files...
  > No files to remove.
  > Checking for uncommitted changes in the git working tree...
  > Found 2 changed files.
  > Fetching repo...
  { raw: '', remote: null, branches: [], tags: [] }
  > Pulling from remote...
  { raw: '', remote: null, branches: [], tags: [] }
  Error: Error: Could not read from remote repository.
Outputs
  committed: false
  commit_long_sha: undefined
  commit_sha: undefined
  pushed: false
  tagged: false
  tag_pushed: false
Error: Error: Could not read from remote repository.

Activity

  1. EndBug commented on Oct 31, 2022

    @EndBug
    Owner

    The info in this logs is not sufficient to determine the cause of the issue
    Would you be able to provide some context on the previous steps?

  2. vitalyk-multinarity commented on Nov 1, 2022

    @vitalyk-multinarity
    Author

    The info in this logs is not sufficient to determine the cause of the issue Would you be able to provide some context on the previous steps?

    Sure! In fact, there are no tricky things in my workflow - I run checkout, build, copy a few files into the local repo, and want to update them into the remote repo.

    - name: Checkout Sources
          uses: actions/checkout@v3
          with:
              lfs: true
              fetch-depth: '0'
              submodules: 'true'
              token: ${{ secrets.CI_TOKEN }}
    
  3. EndBug commented on Nov 5, 2022

    @EndBug
    Owner

    @vitalyk-multinarity What happens if you remove fetch-depth from the actions/checkout inputs? There are some users that reported weird behavior while using that argument.

  4. vitalyk-multinarity commented on Nov 6, 2022

    @vitalyk-multinarity
    Author
    1. @EndBug - unfortunately that didn't help. There is no "couldn't read from remote repo" error, but instead of this I'm getting "fatal: remote error: upload-pack: not our ref xxxxxxx" for one of submodules
    2. When I tried to replace add-and-commit with a plain shell, that works as follows:
            git config --global user.email "ci@example.com"
             git config --global user.name "CI GitHub"
             git add Assets/........./libs/
             git commit -m "CI: Updating control-*.aar [skip ci]"
             git push
    
  5. EndBug commented on Nov 6, 2022

    @EndBug
    Owner

    I think I figured it out ahahha
    You've set pull to NO-PULL, while you should have just not used it. It can't pull because your repo has no "NO-PULL" ref!

    I think that if you try using this it'll work:

     - name: Update  plugins  
       uses: EndBug/add-and-commit@v9
       with:
         add: 'my_path'
         message: 'CI: Updating control-*.aar [skip ci]'
  6. vitalyk-multinarity commented on Nov 7, 2022

    @vitalyk-multinarity
    Author

    Many thanks, it works!
    Either I misunderstood the Readme, or it's not updated:

    Arguments for the git pull command. By default, the action does not pull

    I do want pull before add&push, because my workflow should commit twice (two separate components). So I tried to use 'pull:true' and, after getting errors, modified it to 'NO-PULL', probably according to an outdated doc.

  7. EndBug commented on Nov 7, 2022

    @EndBug
    Owner

    NO-PULL was an option in the past, but it has been removed in v8.0.0
    Happy to hear that everything works! I'll close the issue for now

  8. vitalyk-multinarity commented on Nov 7, 2022

    @vitalyk-multinarity
    Author

    So if I understand properly, by default your action v9 does pull?

  9. EndBug commented on Nov 7, 2022

    @EndBug
    Owner

    No, the action does not pull by default.

  10. vitalyk-multinarity commented on Nov 7, 2022

    @vitalyk-multinarity
    Author

    I don't want to be a 'nudnik', but in this case, I don't understand how my workflow works.
    I do the following:

    1. checkout
    2. update dir1/module1
    3. update dir2/module2
    4. use add-and-commit with 'add:dir1'
    5. use add-and-commit with 'add:dir2'

    IMHO, #5 cannot work without pull...

  11. EndBug commented on Nov 7, 2022

    @EndBug
    Owner

    Don't worry ahahaha
    It can work because the history is not reset when the action runs. As long as you don't push anything right after the first commit, the second will always be a fast-forward push.
    This is the same behavior as if you were to use:

    git commit
    git push
    git commit
    git push
  12. vitalyk-multinarity commented on Nov 7, 2022

    @vitalyk-multinarity
    Author

    Of course, you're right - this is really trivial scenario.
    Thank you for your patience and shame on me!

  13. EndBug commented on Nov 7, 2022

    @EndBug
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: pendingMore info is needed before deciding what to do

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions