-
-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fatal: A branch named 'main' already exists. #1388
Comments
Does it work if you turn single-commit to false? This may be access token scope related as cross-deploying to repos with single-commit should work. Can you try increasing the permissions and see if that works? |
Nope, same error. It does work if I set the branch to anything else but main, e.g., branch: main2 |
Couple of questions:
|
When creating a repo via the API as in the original post, there is no code, and no branch
Full access to private repos.
Yes. (I don't think permissions are a problem since I can create repos with the key, and it all works if I use The error message suggests that github-pages-deploy-actions calls
in a repo where a |
I encountered the same issue. The problem is triggered under two conditions:
It seems that when there are no commits in the selected branch, this action tries to create it, but this branch actually already exists. I suspect that the issue may be triggered if a target branch does not have any commits (not just in wholly new repositories), but haven't tested yet. BTW:
the error message:
|
I got the same issue when deploying with "single-commit=true" + "clean:false" to the root "/" of an orphan branch (gh-pages). This works: - name: Commit versions.json
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: versions_folder # The folder the action should deploy.
target-folder: / # The folder the action should deploy to.
commit-message: publish documentation
clean: false # do not remove other files (including whole doc versions) This does not work: - name: Commit versions.json
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: versions_folder # The folder the action should deploy.
target-folder: / # The folder the action should deploy to.
commit-message: publish documentation
clean: false # do not remove other files (including whole doc versions)
single-commit: true This worked also:
- name: Deploy documentation in a version subfolder on GH pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy.
target-folder: /main # The folder the action should deploy to.
commit-message: publish documentation
single-commit: true
- name: Deploy documentation in root folder on GH pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/.vuepress/dist # The folder the action should deploy.
target-folder: / # The folder the action should deploy to.
commit-message: publish documentation
single-commit: true
clean-exclude: |
"version/*" |
I found why i add examples working and others not working. Actually in the example not working (single-commit:true) i was also doing a checkout of gh-pages (the very branch on which i want to deploy) before in order to parse something. So this is the sequence making the bug:
update-doc-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: gh-pages
- name: Do some stuff to generate something in versions_folder
run: ...
- name: Commit versions.json
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: versions_folder # The folder the action should deploy.
target-folder: / # The folder the action should deploy to.
commit-message: publish documentation
clean: false # do not remove other files (including whole doc versions)
single-commit: true
|
In a GitHub action, I create a fresh repo with
I'd like to deploy to this repo with
This then fails with
Any idea what's going wrong?
The text was updated successfully, but these errors were encountered: