Skip to content

Settings gh-pages branch to current branch results in fatal Error: 'Refusing to fetch into current branch' #51

@NathanielRN

Description

@NathanielRN

This action says in the documentation that if your docs build from your master branch you should simply set the gh-pages-branch to master to have it make a commit on that branch instead.

However, if you trigger the workflow while you are on the master branch itself, then because the action runs a git fetch <branch>:<branch> the action will fail with error:

/usr/bin/git -c user.name=github-action-benchmark -c user.email=github@users.noreply.github.com -c http.https://github.com/.extraheader= fetch origin master:master
fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository
Error: Command 'git' failed with args '-c user.name=github-action-benchmark -c user.email=github@users.noreply.github.com -c http.https://github.com/.extraheader= fetch origin master:master': fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository

See this workflow for an example.

Possible solutions include adding a field

should-fetch: true|false

to indicate whether the branch needs to be fetched before creating a commit.

Thank you for the awesome action!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions