Agit workflow instructions do not work #11833

Closed
opened 2025-11-02 09:49:11 -06:00 by GiteaMirror · 12 comments
Owner

Originally created by @strk on GitHub (Oct 11, 2023).

Description

I've followed instructions in https://docs.gitea.com/usage/agit-setup but could not make a pull request automatically created.
Logs of Gitea also don't mention anything.

$ git push origin HEAD:refs/for/master -o title="Test title" -o topic="Test topic" -o description="Test description"
To git.osgeo.org:postgis/postgis.git
 * [new reference]       HEAD -> refs/for/master

Gitea Version

1.20.5

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

The test I've run on try.gitea.io failed but in a different way:

[strk@c19:/tmp/test2(agit)] git push origin HEAD:refs/for/master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 257 bytes | 257.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: 
remote: Gitea: Unexpected ref: refs/for/master
To try.gitea.io:strk/test2.git
 ! [remote rejected] HEAD -> refs/for/master (pre-receive hook declined)
error: failed to push some refs to 'try.gitea.io:strk/test2.git'

Database

None

Originally created by @strk on GitHub (Oct 11, 2023). ### Description I've followed instructions in https://docs.gitea.com/usage/agit-setup but could not make a pull request automatically created. Logs of Gitea also don't mention anything. ``` $ git push origin HEAD:refs/for/master -o title="Test title" -o topic="Test topic" -o description="Test description" To git.osgeo.org:postgis/postgis.git * [new reference] HEAD -> refs/for/master ``` ### Gitea Version 1.20.5 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? The test I've run on try.gitea.io failed but in a different way: ``` [strk@c19:/tmp/test2(agit)] git push origin HEAD:refs/for/master Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Writing objects: 100% (3/3), 257 bytes | 257.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: remote: Gitea: Unexpected ref: refs/for/master To try.gitea.io:strk/test2.git ! [remote rejected] HEAD -> refs/for/master (pre-receive hook declined) error: failed to push some refs to 'try.gitea.io:strk/test2.git' ``` ### Database None
GiteaMirror added the type/docsissue/needs-feedback labels 2025-11-02 09:49:11 -06:00
Author
Owner

@lng2020 commented on GitHub (Oct 14, 2023):

Currently, the default branch name is main. The docs should be updated.

@lng2020 commented on GitHub (Oct 14, 2023): Currently, the default branch name is main. The docs should be updated.
Author
Owner

@lunny commented on GitHub (Oct 15, 2023):

@strk Could you confirm git push origin HEAD:refs/for/main will fix your problem? The last word should be the base repository target branch name.

@lunny commented on GitHub (Oct 15, 2023): @strk Could you confirm git push origin HEAD:refs/for/main will fix your problem? The last word should be the base repository target branch name.
Author
Owner

@strk commented on GitHub (Oct 16, 2023):

In our case the base repository target branch is still "master", but I confirm try.osgeo.org does work if I push to the target repository. I've yet to test doing this on try.osgeo.org and ideed it works (as long as -o topic is given).

Is it supposed to also work when pushing to fork instead of target repository ?

@strk commented on GitHub (Oct 16, 2023): In our case the base repository target branch is still "master", but I confirm try.osgeo.org does work if I push to the target repository. I've yet to test doing this on try.osgeo.org and ideed it works (as long as `-o topic` is given). Is it supposed to also work when pushing to fork instead of target repository ?
Author
Owner

@lunny commented on GitHub (Oct 16, 2023):

In our case the base repository target branch is still "master", but I confirm try.osgeo.org does work if I push to the target repository. I've yet to test doing this on try.osgeo.org and ideed it works (as long as -o topic is given).

Is it supposed to also work when pushing to fork instead of target repository ?

Pushing to fork will create a PR of the fork repository. In Agit workflow, there is no fork concept.

@lunny commented on GitHub (Oct 16, 2023): > In our case the base repository target branch is still "master", but I confirm try.osgeo.org does work if I push to the target repository. I've yet to test doing this on try.osgeo.org and ideed it works (as long as `-o topic` is given). > > Is it supposed to also work when pushing to fork instead of target repository ? Pushing to fork will create a PR of the fork repository. In Agit workflow, there is no fork concept.
Author
Owner

@strk commented on GitHub (Oct 16, 2023):

So, I've tried back to git.osgeo.org/gitea and neither pushing refs/for/master (the real name of target) nor refs/for/main triggered the creation of a pull request. Rather those refs were created in the origin repository:

[strk@c19:/usr/local/src/postgis/postgis(drop-obsoleted-strings)] git push origin HEAD:refs/for/main -o topic="test topic"
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 8 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 575 bytes | 575.00 KiB/s, done.
Total 6 (delta 4), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To git.osgeo.org:postgis/postgis.git
 * [new reference]       HEAD -> refs/for/main
[strk@c19:/usr/local/src/postgis/postgis(drop-obsoleted-strings)] git push origin HEAD:refs/for/master -o topic="test topic"
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To git.osgeo.org:postgis/postgis.git
 * [new reference]       HEAD -> refs/for/master
@strk commented on GitHub (Oct 16, 2023): So, I've tried back to git.osgeo.org/gitea and neither pushing refs/for/master (the real name of target) nor refs/for/main triggered the creation of a pull request. Rather those refs were created in the origin repository: ``` [strk@c19:/usr/local/src/postgis/postgis(drop-obsoleted-strings)] git push origin HEAD:refs/for/main -o topic="test topic" Enumerating objects: 11, done. Counting objects: 100% (11/11), done. Delta compression using up to 8 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 575 bytes | 575.00 KiB/s, done. Total 6 (delta 4), reused 0 (delta 0), pack-reused 0 remote: . Processing 1 references remote: Processed 1 references in total To git.osgeo.org:postgis/postgis.git * [new reference] HEAD -> refs/for/main [strk@c19:/usr/local/src/postgis/postgis(drop-obsoleted-strings)] git push origin HEAD:refs/for/master -o topic="test topic" Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 remote: . Processing 1 references remote: Processed 1 references in total To git.osgeo.org:postgis/postgis.git * [new reference] HEAD -> refs/for/master ```
Author
Owner

@lng2020 commented on GitHub (Oct 16, 2023):

but I confirm try.osgeo.org does work if I push to the target repository.

Do you mean try.gitea.io?

So it works in try.gitea.io but doesn't work in your host, which is git.osgeo.org?

@lng2020 commented on GitHub (Oct 16, 2023): > but I confirm try.osgeo.org does work if I push to the target repository. Do you mean try.gitea.io? So it works in try.gitea.io but doesn't work in your host, which is git.osgeo.org?
Author
Owner

@strk commented on GitHub (Oct 16, 2023):

@lng2020 exactly, at least not for this repository: https://git.osgeo.org/gitea/postgis/postgis -- feel free to try !

@strk commented on GitHub (Oct 16, 2023): @lng2020 exactly, at least not for this repository: https://git.osgeo.org/gitea/postgis/postgis -- feel free to try !
Author
Owner

@lng2020 commented on GitHub (Oct 16, 2023):

@lng2020 exactly, at least not for this repository: https://git.osgeo.org/gitea/postgis/postgis -- feel free to try !

will look into it later

@lng2020 commented on GitHub (Oct 16, 2023): > @lng2020 exactly, at least not for this repository: https://git.osgeo.org/gitea/postgis/postgis -- feel free to try ! will look into it later
Author
Owner

@strk commented on GitHub (Oct 16, 2023):

One concern I have is that this support seems to imply anyone can create branches to the target repository effectively making the size associated to that repository bigger, how to limit that ? https://try.gitea.io/strk/test2/pulls/7#issuecomment-169018

@strk commented on GitHub (Oct 16, 2023): One concern I have is that this support seems to imply anyone can create branches to the target repository effectively making the size associated to that repository bigger, how to limit that ? https://try.gitea.io/strk/test2/pulls/7#issuecomment-169018
Author
Owner

@strk commented on GitHub (Oct 16, 2023):

Currently, the default branch name is main. The docs should be updated.

I've filed https://github.com/go-gitea/gitea/pull/27652 doing ALSO this

@strk commented on GitHub (Oct 16, 2023): > Currently, the default branch name is main. The docs should be updated. I've filed https://github.com/go-gitea/gitea/pull/27652 doing ALSO this
Author
Owner

@strk commented on GitHub (Oct 16, 2023):

Consulting the source code I saw that "proc-receive" git hook is used for Agit, and that hook is only supported by git starting at version 2.29 -- on git.osgeo.org we're currently runnign an older version of git, which might explain the problem.

@strk commented on GitHub (Oct 16, 2023): Consulting the source code I saw that "proc-receive" git hook is used for Agit, and that hook is only supported by git starting at version 2.29 -- on git.osgeo.org we're currently runnign an older version of git, which might explain the problem.
Author
Owner

@strk commented on GitHub (Oct 16, 2023):

I've added a note about 2.29 requirement in the docs too, in https://github.com/go-gitea/gitea/pull/27652

@strk commented on GitHub (Oct 16, 2023): I've added a note about 2.29 requirement in the docs too, in https://github.com/go-gitea/gitea/pull/27652
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11833