Error when pushing to renamed repository #12200

Closed
opened 2025-11-02 10:01:46 -06:00 by GiteaMirror · 51 comments
Owner

Originally created by @lafriks on GitHub (Dec 13, 2023).

Description

When pushing to/pulling from renamed repository there is error:

git fetch
error: RPC failed; HTTP 307 curl 22 The requested URL returned error: 307
fatal: expected flush after ref listing

Gitea Version

1.21.2

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?

Binary

Database

PostgreSQL

Originally created by @lafriks on GitHub (Dec 13, 2023). ### Description When pushing to/pulling from renamed repository there is error: ``` git fetch error: RPC failed; HTTP 307 curl 22 The requested URL returned error: 307 fatal: expected flush after ref listing ``` ### Gitea Version 1.21.2 ### 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? Binary ### Database PostgreSQL
GiteaMirror added the type/bugissue/workaround labels 2025-11-02 10:01:46 -06:00
Author
Owner

@lunny commented on GitHub (Dec 17, 2023):

Did you push to the old name or the new name?

@lunny commented on GitHub (Dec 17, 2023): Did you push to the old name or the new name?
Author
Owner

@PsychotherapistSam commented on GitHub (Dec 21, 2023):

Hi, same issue here: When pushing to the old URL of a repo that has been moved (in my case from a user to an org), I get the same error. Setting the new remote URL works, of course.

@PsychotherapistSam commented on GitHub (Dec 21, 2023): Hi, same issue here: When pushing to the old URL of a repo that has been moved (in my case from a user to an org), I get the same error. Setting the new remote URL works, of course.
Author
Owner

@lafriks commented on GitHub (Dec 28, 2023):

When pushing to the old remote url, also by just renaming without changing owner

@lafriks commented on GitHub (Dec 28, 2023): When pushing to the old remote url, also by just renaming without changing owner
Author
Owner

@lunny commented on GitHub (Dec 28, 2023):

What's the expectation? Should it be allowed to redirect to the real repository or should it return the 404?

@lunny commented on GitHub (Dec 28, 2023): What's the expectation? Should it be allowed to redirect to the real repository or should it return the 404?
Author
Owner

@chris-08154711 commented on GitHub (Jan 10, 2024):

Same here. Seems like the 1.21.2 update (or previous) broke the redirect functionality for renamed repos or organization or when moving a repo from one orga to another.

Before it was possible to rename/move a repo/orga and still use (fetch, pull, push) the local copy without having to "fix" the remote url. Gitea redirected from the previous remote url to the new location/name automatically.
There was a warning on the console that the operation is executed on a redirected URL.

Please fix! Its a pita to rename an organization with certain number of repos and users without this feature!

@chris-08154711 commented on GitHub (Jan 10, 2024): Same here. Seems like the 1.21.2 update (or previous) broke the redirect functionality for renamed repos or organization or when moving a repo from one orga to another. Before it was possible to rename/move a repo/orga and still use (fetch, pull, push) the local copy without having to "fix" the remote url. Gitea redirected from the previous remote url to the new location/name automatically. There was a warning on the console that the operation is executed on a redirected URL. Please fix! Its a pita to rename an organization with certain number of repos and users without this feature!
Author
Owner

@lafriks commented on GitHub (Jan 22, 2024):

What's the expectation? Should it be allowed to redirect to the real repository or should it return the 404?

Previously it allowed to push to old remote url and it would still work as it was pushed to new repo location

@lafriks commented on GitHub (Jan 22, 2024): > What's the expectation? Should it be allowed to redirect to the real repository or should it return the 404? Previously it allowed to push to old remote url and it would still work as it was pushed to new repo location
Author
Owner

@techknowlogick commented on GitHub (Jan 22, 2024):

Interesting, it appears as though this is because git doesn't accept redirect headers, and we must've previously accepted pushes to renamed repos with a 200 instead of a 308.

This is also interesting as we allow pushes with or without .git trailing, so there should be similar logic.

@techknowlogick commented on GitHub (Jan 22, 2024): Interesting, it appears as though this is because git doesn't accept redirect headers, and we must've previously accepted pushes to renamed repos with a 200 instead of a 308. This is also interesting as we allow pushes with or without .git trailing, so there should be similar logic.
Author
Owner

@lunny commented on GitHub (Feb 19, 2024):

I cannot reproduce this on main branch with http clone/pull/push when renaming the repository under the same user and also transfer to another org.

@lunny commented on GitHub (Feb 19, 2024): I cannot reproduce this on main branch with http clone/pull/push when renaming the repository under the same user and also transfer to another org.
Author
Owner

@chris-08154711 commented on GitHub (Feb 19, 2024):

I cannot reproduce this on main branch with http clone/pull/push when renaming the repository under the same user and also transfer to another org.

Steps to reproduce:

  1. Clone a repo
  2. Rename the repo (or move in another orga) in gitea
  3. Check "git remote -v" on your clone - remote points to the original repo url/name
  4. Try fetch/pull/push with the "invalid" remote url - not working!
  5. The original url is still available in gitea UI but beeing 307 redirected to the renamed repo url

image

image

@chris-08154711 commented on GitHub (Feb 19, 2024): > I cannot reproduce this on main branch with http clone/pull/push when renaming the repository under the same user and also transfer to another org. Steps to reproduce: 1) Clone a repo 2) Rename the repo (or move in another orga) in gitea 3) Check "git remote -v" on your clone - remote points to the original repo url/name 4) Try fetch/pull/push with the "invalid" remote url - not working! 5) The original url is still available in gitea UI but beeing 307 redirected to the renamed repo url ![image](https://github.com/go-gitea/gitea/assets/146172634/fef9e5da-14c3-422e-89c7-e7e3d92caeed) ![image](https://github.com/go-gitea/gitea/assets/146172634/5458e669-5b21-40ab-86c6-64814ef536b3)
Author
Owner

@chris-08154711 commented on GitHub (Feb 20, 2024):

@lunny comment above updated with steps and screenshots (sorry, was in a hurry yesterday and couldn't complete the post)

gitea version: 1.21.1
git client version: git version 2.41.0.windows.3

@chris-08154711 commented on GitHub (Feb 20, 2024): @lunny comment above updated with steps and screenshots (sorry, was in a hurry yesterday and couldn't complete the post) gitea version: 1.21.1 git client version: git version 2.41.0.windows.3
Author
Owner

@newgreenshoot commented on GitHub (Mar 1, 2024):

Just from attempting to quickly bisect this, the last tagged release where this worked was 1.21.0-rc2, and all subsequent versions can't pull/push from renamed repositories when using the old repository URL.

My team suspects that this PR introduced it: https://github.com/go-gitea/gitea/pull/27875

@newgreenshoot commented on GitHub (Mar 1, 2024): Just from attempting to quickly bisect this, the last tagged release where this worked was 1.21.0-rc2, and all subsequent versions can't pull/push from renamed repositories when using the old repository URL. My team suspects that this PR introduced it: https://github.com/go-gitea/gitea/pull/27875
Author
Owner

@lunny commented on GitHub (Mar 2, 2024):

I cannot reproduce this on main branch with http clone/pull/push when renaming the repository under the same user and also transfer to another org.

Steps to reproduce:

1. Clone a repo

2. Rename the repo (or move in another orga) in gitea

3. Check "git remote -v" on your clone - remote points to the original repo url/name

4. Try fetch/pull/push with the "invalid" remote url - not working!

5. The original url is still available in gitea UI but beeing 307 redirected to the renamed repo url

image

image

It works for me on main branch.
image

@lunny commented on GitHub (Mar 2, 2024): > > I cannot reproduce this on main branch with http clone/pull/push when renaming the repository under the same user and also transfer to another org. > > Steps to reproduce: > > 1. Clone a repo > > 2. Rename the repo (or move in another orga) in gitea > > 3. Check "git remote -v" on your clone - remote points to the original repo url/name > > 4. Try fetch/pull/push with the "invalid" remote url - not working! > > 5. The original url is still available in gitea UI but beeing 307 redirected to the renamed repo url > > > ![image](https://private-user-images.githubusercontent.com/146172634/306210569-fef9e5da-14c3-422e-89c7-e7e3d92caeed.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDkyNzc4ODEsIm5iZiI6MTcwOTI3NzU4MSwicGF0aCI6Ii8xNDYxNzI2MzQvMzA2MjEwNTY5LWZlZjllNWRhLTE0YzMtNDIyZS04OWM3LWU3ZTNkOTJjYWVlZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMzAxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDMwMVQwNzE5NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wZmM3MmRhY2U5M2VjMWRmYmIyNWRlMTg4MDI5YzJhMzExZTc2MmJlM2JhNWJkZmQ1MDhmYzY4YzM5OWM2ZTEyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.-94nSUjDnD5QfIEvodCG621F5LvVzKNUvA5AdrhW6r8) > > ![image](https://private-user-images.githubusercontent.com/146172634/306210672-5458e669-5b21-40ab-86c6-64814ef536b3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDkyNzc4ODEsIm5iZiI6MTcwOTI3NzU4MSwicGF0aCI6Ii8xNDYxNzI2MzQvMzA2MjEwNjcyLTU0NThlNjY5LTViMjEtNDBhYi04NmM2LTY0ODE0ZWY1MzZiMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMzAxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDMwMVQwNzE5NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xMDBiYjBjNDIyNWEyZmY2YTQyN2ZkZGZkNzY3Mjk2NDUyZGY2MjY4YzAxMzZjOGQwZmRiMmUyYzhiMzYzN2VmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.i4MKKfJu017bExNJiokC26zQ9gE4eX6bi3rN3AdO6zU) It works for me on main branch. <img width="723" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/2de4987e-eede-46b9-98a6-19d08913e494">
Author
Owner

@j123b567 commented on GitHub (Mar 5, 2024):

gitea: 1.21.5
git client: 2.44.0 and 2.43.0 on linux
gitea is behind reverse proxy using Apache 2.4.57

Running git clone with GIT_CURL_VERBOSE=1 and GIT_TRACE=1. This is HTTP communication from the trace.

POST /<redacted>/<redacted>.git/git-upload-pack HTTP/1.1
Host: <redacted>
Authorization: Basic <redacted>
User-Agent: git/2.44.0
Accept-Encoding: deflate, gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Accept-Language: cs-CZ, *;q=0.9
Git-Protocol: version=2
Content-Length: 175

HTTP/1.1 307 Temporary Redirect
Date: Tue, 05 Mar 2024 10:24:42 GMT
Server: Apache/2.4.57 (Debian)
Cache-Control: max-age=0, private, must-revalidate, no-transform
Location: /<redacted>/<redacted>/git-upload-pack
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Set-Cookie: i_like_gitea=<redacted>; Path=/; HttpOnly; Secure; SameSite=Lax
Set-Cookie: _csrf=<redacted>; Path=/; Max-Age=86400; HttpOnly; Secure; SameSite=Lax

Same error
error: RPC failed; HTTP 307 curl 22 The requested URL returned error: 307

@j123b567 commented on GitHub (Mar 5, 2024): gitea: 1.21.5 git client: 2.44.0 and 2.43.0 on linux **gitea is behind reverse proxy using Apache 2.4.57** Running `git clone` with `GIT_CURL_VERBOSE=1` and `GIT_TRACE=1`. This is HTTP communication from the trace. ``` POST /<redacted>/<redacted>.git/git-upload-pack HTTP/1.1 Host: <redacted> Authorization: Basic <redacted> User-Agent: git/2.44.0 Accept-Encoding: deflate, gzip Content-Type: application/x-git-upload-pack-request Accept: application/x-git-upload-pack-result Accept-Language: cs-CZ, *;q=0.9 Git-Protocol: version=2 Content-Length: 175 HTTP/1.1 307 Temporary Redirect Date: Tue, 05 Mar 2024 10:24:42 GMT Server: Apache/2.4.57 (Debian) Cache-Control: max-age=0, private, must-revalidate, no-transform Location: /<redacted>/<redacted>/git-upload-pack X-Frame-Options: SAMEORIGIN Content-Length: 0 Set-Cookie: i_like_gitea=<redacted>; Path=/; HttpOnly; Secure; SameSite=Lax Set-Cookie: _csrf=<redacted>; Path=/; Max-Age=86400; HttpOnly; Secure; SameSite=Lax ``` Same error `error: RPC failed; HTTP 307 curl 22 The requested URL returned error: 307`
Author
Owner

@le-patenteux commented on GitHub (Mar 5, 2024):

I can confirm the issue. Using Gitea 1.21.7 with docker from the linuxserver.io image.
Since we are a small team, I simply had to reset the git origin on my local clone to the new name, but I had to look around for 30 minutes before I found the issue!
Good luck all

@le-patenteux commented on GitHub (Mar 5, 2024): I can confirm the issue. Using Gitea 1.21.7 with docker from the linuxserver.io image. Since we are a small team, I simply had to reset the git origin on my local clone to the new name, but I had to look around for 30 minutes before I found the issue! Good luck all
Author
Owner

@newgreenshoot commented on GitHub (May 29, 2024):

What sorts of setups are other people using? Is Gitea running behind a reverse proxy? Are you requiring HTTP authentication? I'm starting to wonder if there's some specific configuration detail that's responsible for this, since @lunny can't reproduce it under normal conditions. https://github.com/go-gitea/gitea/pull/27875 certainly seems to be responsible though.

This appears to still affect v1.22.0, and my organization is unable to update past v1.21.0-rc2 due to this.

@newgreenshoot commented on GitHub (May 29, 2024): What sorts of setups are other people using? Is Gitea running behind a reverse proxy? Are you requiring HTTP authentication? I'm starting to wonder if there's some specific configuration detail that's responsible for this, since @lunny can't reproduce it under normal conditions. https://github.com/go-gitea/gitea/pull/27875 certainly seems to be responsible though. This appears to still affect v1.22.0, and my organization is unable to update past v1.21.0-rc2 due to this.
Author
Owner

@netsrotr commented on GitHub (Jul 22, 2024):

We have an possibly related issue renaming a branch via our gitea v 1.21.4 website. If we are at the "branches" view, and try to rename a branch via "rename" symbol at the right side of the branch in question, we get back an http error 404.

@netsrotr commented on GitHub (Jul 22, 2024): We have an possibly related issue renaming a branch via our gitea v 1.21.4 website. If we are at the "branches" view, and try to rename a branch via "rename" symbol at the right side of the branch in question, we get back an http error 404.
Author
Owner

@robertschulze commented on GitHub (Jul 30, 2024):

We have the same issue in 1.21.10. It appears an upgrade will not solve it, is it correct?

@robertschulze commented on GitHub (Jul 30, 2024): We have the same issue in 1.21.10. It appears an upgrade will not solve it, is it correct?
Author
Owner

@robertschulze commented on GitHub (Jul 30, 2024):

What sorts of setups are other people using? Is Gitea running behind a reverse proxy? Are you requiring HTTP authentication? I'm starting to wonder if there's some specific configuration detail that's responsible for this, since @lunny can't reproduce it under normal conditions. #27875 certainly seems to be responsible though.

This appears to still affect v1.22.0, and my organization is unable to update past v1.21.0-rc2 due to this.

Yes, we are running Gitea behind a reverse proxy (Apache 2.4.58).

@robertschulze commented on GitHub (Jul 30, 2024): > What sorts of setups are other people using? Is Gitea running behind a reverse proxy? Are you requiring HTTP authentication? I'm starting to wonder if there's some specific configuration detail that's responsible for this, since @lunny can't reproduce it under normal conditions. #27875 certainly seems to be responsible though. > > This appears to still affect v1.22.0, and my organization is unable to update past v1.21.0-rc2 due to this. Yes, we are running Gitea behind a reverse proxy (Apache 2.4.58).
Author
Owner

@netsrotr commented on GitHub (Jul 30, 2024):

We have an possibly related issue renaming a branch via our gitea v 1.21.4 website. If we are at the "branches" view, and try to rename a branch via "rename" symbol at the right side of the branch in question, we get back an http error 404.

Gitea is running behind a apache proxy.

@netsrotr commented on GitHub (Jul 30, 2024): > We have an possibly related issue renaming a branch via our gitea v 1.21.4 website. If we are at the "branches" view, and try to rename a branch via "rename" symbol at the right side of the branch in question, we get back an http error 404. Gitea is running behind a apache proxy.
Author
Owner

@le-patenteux commented on GitHub (Jul 30, 2024):

Gitea behind swag (NGINX), authentication by Gitea itself for me.
I can't say if the issue has returned as we did not rename a repo since the incident in march

@le-patenteux commented on GitHub (Jul 30, 2024): Gitea behind swag (NGINX), authentication by Gitea itself for me. I can't say if the issue has returned as we did not rename a repo since the incident in march
Author
Owner

@winston0410 commented on GitHub (Oct 5, 2024):

I encountered this issue, after changing my username.

@winston0410 commented on GitHub (Oct 5, 2024): I encountered this issue, after changing my username.
Author
Owner

@lunny commented on GitHub (Oct 5, 2024):

Please confirm with no reverse proxy after you upgrade to 1.22.2 and I still cannot reproduce it in main branch and 1.22.2 .

@lunny commented on GitHub (Oct 5, 2024): Please confirm with no reverse proxy after you upgrade to 1.22.2 and I still cannot reproduce it in main branch and 1.22.2 .
Author
Owner

@GiteaBot commented on GitHub (Nov 5, 2024):

We close issues that need feedback from the author if there were no new comments for a month. 🍵

@GiteaBot commented on GitHub (Nov 5, 2024): We close issues that need feedback from the author if there were no new comments for a month. :tea:
Author
Owner

@lunny commented on GitHub (Nov 5, 2024):

@lafriks Can you confirm this is still a problem?

@lunny commented on GitHub (Nov 5, 2024): @lafriks Can you confirm this is still a problem?
Author
Owner

@netsrotr commented on GitHub (Nov 5, 2024):

Rename branch with v1.22.3 works now--Gesendet mit der GMX Mail AppAm 05.11.24, 06:54 schrieb Lunny Xiao @.***>:

@lafriks Can you confirm this is still a problem?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

@netsrotr commented on GitHub (Nov 5, 2024): Rename branch with v1.22.3 works now--Gesendet mit der GMX Mail AppAm 05.11.24, 06:54 schrieb Lunny Xiao ***@***.***>: @lafriks Can you confirm this is still a problem? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
Author
Owner

@GalaxySnail commented on GitHub (Dec 17, 2024):

This is still a problem after we upgraded to 1.22.6. We are running gitea behind caddy.

@GalaxySnail commented on GitHub (Dec 17, 2024): This is still a problem after we upgraded to 1.22.6. We are running gitea behind caddy.
Author
Owner

@lunny commented on GitHub (Dec 17, 2024):

Can you reproduce it on demo site?

@lunny commented on GitHub (Dec 17, 2024): Can you reproduce it on demo site?
Author
Owner

@GalaxySnail commented on GitHub (Dec 17, 2024):

How to reproduce it on demo site? It requires a renamed repo, but I can't figure out which repo is renamed on demo site.

@GalaxySnail commented on GitHub (Dec 17, 2024): How to reproduce it on demo site? It requires a renamed repo, but I can't figure out which repo is renamed on demo site.
Author
Owner

@lunny commented on GitHub (Dec 17, 2024):

You can create a new repository -> rename it and push a commit to the new repository.

@lunny commented on GitHub (Dec 17, 2024): You can create a new repository -> rename it and push a commit to the new repository.
Author
Owner

@GalaxySnail commented on GitHub (Dec 18, 2024):

I can't reproduce it on demo site. These are HTTP requests sent by git remote show origin on our gitea instance:

> CONNECT <domain_name>:443 HTTP/1.1
> Host: <domain_name>:443
> User-Agent: git/2.47.1
> Proxy-Connection: Keep-Alive

< HTTP/1.1 200 Connection established

Info: using HTTP/2
Info: [HTTP/2] [1] OPENED stream for https://<domain_name>/GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack
Info: [HTTP/2] [1] [:method: GET]
Info: [HTTP/2] [1] [:scheme: https]
Info: [HTTP/2] [1] [:authority: <domain_name>]
Info: [HTTP/2] [1] [:path: /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack]
Info: [HTTP/2] [1] [user-agent: git/2.47.1]
Info: [HTTP/2] [1] [accept: */*]
Info: [HTTP/2] [1] [accept-encoding: deflate, gzip, br, zstd]
Info: [HTTP/2] [1] [pragma: no-cache]
Info: [HTTP/2] [1] [git-protocol: version=2]

> GET /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack HTTP/2
> Host: <domain_name>
> User-Agent: git/2.47.1
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> Pragma: no-cache
> Git-Protocol: version=2

< HTTP/2 401
< date: Wed, 18 Dec 2024 10:59:31 GMT
< content-type: text/plain; charset=utf-8
< content-length: 13
< alt-svc: h3=":443"; ma=86400
< cache-control: max-age=0, private, must-revalidate, no-transform
< set-cookie: i_like_gitea=<edited> SameSite=Lax
< set-cookie: _csrf=<edited> SameSite=Lax
< www-authenticate: Basic realm="Gitea"
< x-content-type-options: nosniff
< x-frame-options: SAMEORIGIN
< cf-cache-status: DYNAMIC
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=<edited>"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: <edited>
< server-timing: <edited>

Info: Re-using existing connection with proxy 127.0.0.1
Info: Server auth using Basic with user 'GalaxySnail'
Info: [HTTP/2] [3] OPENED stream for https://<domain_name>/GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack
Info: [HTTP/2] [3] [:method: GET]
Info: [HTTP/2] [3] [:scheme: https]
Info: [HTTP/2] [3] [:authority: <domain_name>]
Info: [HTTP/2] [3] [:path: /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack]
Info: [HTTP/2] [3] [authorization: Basic <redacted>]
Info: [HTTP/2] [3] [user-agent: git/2.47.1]
Info: [HTTP/2] [3] [accept: */*]
Info: [HTTP/2] [3] [accept-encoding: deflate, gzip, br, zstd]
Info: [HTTP/2] [3] [pragma: no-cache]
Info: [HTTP/2] [3] [git-protocol: version=2]

> GET /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack HTTP/2
> Host: <domain_name>
> Authorization: Basic <redacted>
> User-Agent: git/2.47.1
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> Pragma: no-cache
> Git-Protocol: version=2

< HTTP/2 307
< date: Wed, 18 Dec 2024 10:59:40 GMT
< content-type: text/html; charset=utf-8
< content-length: 93
< alt-svc: h3=":443"; ma=86400
< cache-control: max-age=0, private, must-revalidate, no-transform
< location: /shared/<repo_name>/info/refs?service=git-upload-pack
< set-cookie: i_like_gitea=<edited> SameSite=Lax
< set-cookie: _csrf=<edited> SameSite=Lax
< x-frame-options: SAMEORIGIN
< cf-cache-status: DYNAMIC
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=<edited>"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: <edited>
< server-timing: <edited>

Info: Connection #0 to host 127.0.0.1 left intact
Info: Issue another request to this URL: 'https://GalaxySnail:<password>@<domain_name>/shared/<repo_name>/info/refs?service=git-upload-pack'
Info: Re-using existing connection with proxy 127.0.0.1
Info: Server auth using Basic with user 'GalaxySnail'
Info: [HTTP/2] [5] OPENED stream for https://GalaxySnail:<password>@<domain_name>/shared/<repo_name>/info/refs?service=git-upload-pack
Info: [HTTP/2] [5] [:method: GET]
Info: [HTTP/2] [5] [:scheme: https]
Info: [HTTP/2] [5] [:authority: <domain_name>]
Info: [HTTP/2] [5] [:path: /shared/<repo_name>/info/refs?service=git-upload-pack]
Info: [HTTP/2] [5] [authorization: Basic <redacted>]
Info: [HTTP/2] [5] [user-agent: git/2.47.1]
Info: [HTTP/2] [5] [accept: */*]
Info: [HTTP/2] [5] [accept-encoding: deflate, gzip, br, zstd]
Info: [HTTP/2] [5] [pragma: no-cache]
Info: [HTTP/2] [5] [git-protocol: version=2]

> GET /shared/<repo_name>/info/refs?service=git-upload-pack HTTP/2
> Host: <domain_name>
> Authorization: Basic <redacted>
> User-Agent: git/2.47.1
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> Pragma: no-cache
> Git-Protocol: version=2

< HTTP/2 200
< date: Wed, 18 Dec 2024 10:59:41 GMT
< content-type: application/x-git-upload-pack-advertisement
< content-length: 188
< alt-svc: h3=":443"; ma=86400
< cache-control: no-cache, max-age=0, must-revalidate
< expires: Fri, 01 Jan 1980 00:00:00 GMT
< pragma: no-cache
< set-cookie: i_like_gitea=<edited> SameSite=Lax
< set-cookie: _csrf=<edited> SameSite=Lax
< x-frame-options: SAMEORIGIN
< cf-cache-status: DYNAMIC
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=<edited>"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: <edited>
< server-timing: <edited>

Info: Re-using existing connection with proxy 127.0.0.1
Info: Server auth using Basic with user 'GalaxySnail'
Info: [HTTP/2] [7] OPENED stream for https://<domain_name>/GalaxySnail/<repo_name>.git/git-upload-pack
Info: [HTTP/2] [7] [:method: POST]
Info: [HTTP/2] [7] [:scheme: https]
Info: [HTTP/2] [7] [:authority: <domain_name>]
Info: [HTTP/2] [7] [:path: /GalaxySnail/<repo_name>.git/git-upload-pack]
Info: [HTTP/2] [7] [authorization: Basic <redacted>]
Info: [HTTP/2] [7] [user-agent: git/2.47.1]
Info: [HTTP/2] [7] [accept-encoding: deflate, gzip, br, zstd]
Info: [HTTP/2] [7] [content-type: application/x-git-upload-pack-request]
Info: [HTTP/2] [7] [accept: application/x-git-upload-pack-result]
Info: [HTTP/2] [7] [git-protocol: version=2]
Info: [HTTP/2] [7] [content-length: 102]

> POST /GalaxySnail/<repo_name>.git/git-upload-pack HTTP/2
> Host: <domain_name>
> Authorization: Basic <redacted>
> User-Agent: git/2.47.1
> Accept-Encoding: deflate, gzip, br, zstd
> Content-Type: application/x-git-upload-pack-request
> Accept: application/x-git-upload-pack-result
> Git-Protocol: version=2
> Content-Length: 102

< HTTP/2 307
< date: Wed, 18 Dec 2024 10:59:41 GMT
< content-length: 0
< alt-svc: h3=":443"; ma=86400
< cache-control: max-age=0, private, must-revalidate, no-transform
< location: /shared/<repo_name>/git-upload-pack
< set-cookie: i_like_gitea=<edited> SameSite=Lax
< set-cookie: _csrf=<edited> SameSite=Lax
< x-frame-options: SAMEORIGIN
< cf-cache-status: DYNAMIC
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=<edited>"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: <edited>
< server-timing: <edited>

Info: Connection #0 to host 127.0.0.1 left intact

error: RPC failed; HTTP 307 curl 22 The requested URL returned error: 307
fatal: expected flush after ref listing

It seems related to the fact that we enabled [service].REQUIRE_SIGNIN_VIEW.

@GalaxySnail commented on GitHub (Dec 18, 2024): I can't reproduce it on demo site. These are HTTP requests sent by `git remote show origin` on our gitea instance: <details> ``` > CONNECT <domain_name>:443 HTTP/1.1 > Host: <domain_name>:443 > User-Agent: git/2.47.1 > Proxy-Connection: Keep-Alive < HTTP/1.1 200 Connection established Info: using HTTP/2 Info: [HTTP/2] [1] OPENED stream for https://<domain_name>/GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack Info: [HTTP/2] [1] [:method: GET] Info: [HTTP/2] [1] [:scheme: https] Info: [HTTP/2] [1] [:authority: <domain_name>] Info: [HTTP/2] [1] [:path: /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack] Info: [HTTP/2] [1] [user-agent: git/2.47.1] Info: [HTTP/2] [1] [accept: */*] Info: [HTTP/2] [1] [accept-encoding: deflate, gzip, br, zstd] Info: [HTTP/2] [1] [pragma: no-cache] Info: [HTTP/2] [1] [git-protocol: version=2] > GET /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack HTTP/2 > Host: <domain_name> > User-Agent: git/2.47.1 > Accept: */* > Accept-Encoding: deflate, gzip, br, zstd > Pragma: no-cache > Git-Protocol: version=2 < HTTP/2 401 < date: Wed, 18 Dec 2024 10:59:31 GMT < content-type: text/plain; charset=utf-8 < content-length: 13 < alt-svc: h3=":443"; ma=86400 < cache-control: max-age=0, private, must-revalidate, no-transform < set-cookie: i_like_gitea=<edited> SameSite=Lax < set-cookie: _csrf=<edited> SameSite=Lax < www-authenticate: Basic realm="Gitea" < x-content-type-options: nosniff < x-frame-options: SAMEORIGIN < cf-cache-status: DYNAMIC < report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=<edited>"}],"group":"cf-nel","max_age":604800} < nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} < server: cloudflare < cf-ray: <edited> < server-timing: <edited> Info: Re-using existing connection with proxy 127.0.0.1 Info: Server auth using Basic with user 'GalaxySnail' Info: [HTTP/2] [3] OPENED stream for https://<domain_name>/GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack Info: [HTTP/2] [3] [:method: GET] Info: [HTTP/2] [3] [:scheme: https] Info: [HTTP/2] [3] [:authority: <domain_name>] Info: [HTTP/2] [3] [:path: /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack] Info: [HTTP/2] [3] [authorization: Basic <redacted>] Info: [HTTP/2] [3] [user-agent: git/2.47.1] Info: [HTTP/2] [3] [accept: */*] Info: [HTTP/2] [3] [accept-encoding: deflate, gzip, br, zstd] Info: [HTTP/2] [3] [pragma: no-cache] Info: [HTTP/2] [3] [git-protocol: version=2] > GET /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack HTTP/2 > Host: <domain_name> > Authorization: Basic <redacted> > User-Agent: git/2.47.1 > Accept: */* > Accept-Encoding: deflate, gzip, br, zstd > Pragma: no-cache > Git-Protocol: version=2 < HTTP/2 307 < date: Wed, 18 Dec 2024 10:59:40 GMT < content-type: text/html; charset=utf-8 < content-length: 93 < alt-svc: h3=":443"; ma=86400 < cache-control: max-age=0, private, must-revalidate, no-transform < location: /shared/<repo_name>/info/refs?service=git-upload-pack < set-cookie: i_like_gitea=<edited> SameSite=Lax < set-cookie: _csrf=<edited> SameSite=Lax < x-frame-options: SAMEORIGIN < cf-cache-status: DYNAMIC < report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=<edited>"}],"group":"cf-nel","max_age":604800} < nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} < server: cloudflare < cf-ray: <edited> < server-timing: <edited> Info: Connection #0 to host 127.0.0.1 left intact Info: Issue another request to this URL: 'https://GalaxySnail:<password>@<domain_name>/shared/<repo_name>/info/refs?service=git-upload-pack' Info: Re-using existing connection with proxy 127.0.0.1 Info: Server auth using Basic with user 'GalaxySnail' Info: [HTTP/2] [5] OPENED stream for https://GalaxySnail:<password>@<domain_name>/shared/<repo_name>/info/refs?service=git-upload-pack Info: [HTTP/2] [5] [:method: GET] Info: [HTTP/2] [5] [:scheme: https] Info: [HTTP/2] [5] [:authority: <domain_name>] Info: [HTTP/2] [5] [:path: /shared/<repo_name>/info/refs?service=git-upload-pack] Info: [HTTP/2] [5] [authorization: Basic <redacted>] Info: [HTTP/2] [5] [user-agent: git/2.47.1] Info: [HTTP/2] [5] [accept: */*] Info: [HTTP/2] [5] [accept-encoding: deflate, gzip, br, zstd] Info: [HTTP/2] [5] [pragma: no-cache] Info: [HTTP/2] [5] [git-protocol: version=2] > GET /shared/<repo_name>/info/refs?service=git-upload-pack HTTP/2 > Host: <domain_name> > Authorization: Basic <redacted> > User-Agent: git/2.47.1 > Accept: */* > Accept-Encoding: deflate, gzip, br, zstd > Pragma: no-cache > Git-Protocol: version=2 < HTTP/2 200 < date: Wed, 18 Dec 2024 10:59:41 GMT < content-type: application/x-git-upload-pack-advertisement < content-length: 188 < alt-svc: h3=":443"; ma=86400 < cache-control: no-cache, max-age=0, must-revalidate < expires: Fri, 01 Jan 1980 00:00:00 GMT < pragma: no-cache < set-cookie: i_like_gitea=<edited> SameSite=Lax < set-cookie: _csrf=<edited> SameSite=Lax < x-frame-options: SAMEORIGIN < cf-cache-status: DYNAMIC < report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=<edited>"}],"group":"cf-nel","max_age":604800} < nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} < server: cloudflare < cf-ray: <edited> < server-timing: <edited> Info: Re-using existing connection with proxy 127.0.0.1 Info: Server auth using Basic with user 'GalaxySnail' Info: [HTTP/2] [7] OPENED stream for https://<domain_name>/GalaxySnail/<repo_name>.git/git-upload-pack Info: [HTTP/2] [7] [:method: POST] Info: [HTTP/2] [7] [:scheme: https] Info: [HTTP/2] [7] [:authority: <domain_name>] Info: [HTTP/2] [7] [:path: /GalaxySnail/<repo_name>.git/git-upload-pack] Info: [HTTP/2] [7] [authorization: Basic <redacted>] Info: [HTTP/2] [7] [user-agent: git/2.47.1] Info: [HTTP/2] [7] [accept-encoding: deflate, gzip, br, zstd] Info: [HTTP/2] [7] [content-type: application/x-git-upload-pack-request] Info: [HTTP/2] [7] [accept: application/x-git-upload-pack-result] Info: [HTTP/2] [7] [git-protocol: version=2] Info: [HTTP/2] [7] [content-length: 102] > POST /GalaxySnail/<repo_name>.git/git-upload-pack HTTP/2 > Host: <domain_name> > Authorization: Basic <redacted> > User-Agent: git/2.47.1 > Accept-Encoding: deflate, gzip, br, zstd > Content-Type: application/x-git-upload-pack-request > Accept: application/x-git-upload-pack-result > Git-Protocol: version=2 > Content-Length: 102 < HTTP/2 307 < date: Wed, 18 Dec 2024 10:59:41 GMT < content-length: 0 < alt-svc: h3=":443"; ma=86400 < cache-control: max-age=0, private, must-revalidate, no-transform < location: /shared/<repo_name>/git-upload-pack < set-cookie: i_like_gitea=<edited> SameSite=Lax < set-cookie: _csrf=<edited> SameSite=Lax < x-frame-options: SAMEORIGIN < cf-cache-status: DYNAMIC < report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=<edited>"}],"group":"cf-nel","max_age":604800} < nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} < server: cloudflare < cf-ray: <edited> < server-timing: <edited> Info: Connection #0 to host 127.0.0.1 left intact error: RPC failed; HTTP 307 curl 22 The requested URL returned error: 307 fatal: expected flush after ref listing ``` </details> It seems related to the fact that we enabled `[service].REQUIRE_SIGNIN_VIEW`.
Author
Owner

@lunny commented on GitHub (Dec 18, 2024):

Looks like you are using cloudflare as reverse proxy? Have you tried to push with SSH protocol or without any reverse proxy?

@lunny commented on GitHub (Dec 18, 2024): Looks like you are using cloudflare as reverse proxy? Have you tried to push with SSH protocol or without any reverse proxy?
Author
Owner

@GalaxySnail commented on GitHub (Dec 19, 2024):

I tried it over ssh tunnel without any reverse proxy, and the result is still the same.

Info: Couldn't find host gitea.localhost in the .netrc file; using defaults
Info: Host gitea.localhost:8080 was resolved.
Info: IPv6: ::1
Info: IPv4: 127.0.0.1
Info:   Trying [::1]:8080...
Info: Connected to gitea.localhost (::1) port 8080
Info: using HTTP/1.x

> GET /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack HTTP/1.1
> Host: gitea.localhost:8080
> User-Agent: git/2.47.1
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> Pragma: no-cache
> Git-Protocol: version=2

Info: Request completely sent off

< HTTP/1.1 401 Unauthorized
< Cache-Control: max-age=0, private, must-revalidate, no-transform
< Content-Type: text/plain; charset=utf-8
< Set-Cookie: i_like_gitea=<edited> SameSite=Lax
< Set-Cookie: _csrf=<edited> SameSite=Lax
< Www-Authenticate: Basic realm="Gitea"
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Date: Thu, 19 Dec 2024 11:09:15 GMT
< Content-Length: 13

Info: Connection #0 to host gitea.localhost left intact
Info: Re-using existing connection with host gitea.localhost
Info: Server auth using Basic with user 'GalaxySnail'

> GET /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack HTTP/1.1
> Host: gitea.localhost:8080
> Authorization: Basic <redacted>
> User-Agent: git/2.47.1
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> Pragma: no-cache
> Git-Protocol: version=2

< HTTP/1.1 307 Temporary Redirect
< Cache-Control: max-age=0, private, must-revalidate, no-transform
< Content-Type: text/html; charset=utf-8
< Location: /shared/<repo_name>/info/refs?service=git-upload-pack
< Set-Cookie: i_like_gitea=<edited> SameSite=Lax
< Set-Cookie: _csrf=<edited> SameSite=Lax
< X-Frame-Options: SAMEORIGIN
< Date: Thu, 19 Dec 2024 11:09:19 GMT
< Content-Length: 93

Info: Connection #0 to host gitea.localhost left intact
Info: Issue another request to this URL: 'http://GalaxySnail:<password>@gitea.localhost:8080/shared/<repo_name>/info/refs?service=git-upload-pack'
Info: Re-using existing connection with host gitea.localhost
Info: Server auth using Basic with user 'GalaxySnail'

> GET /shared/<repo_name>/info/refs?service=git-upload-pack HTTP/1.1
> Host: gitea.localhost:8080
> Authorization: Basic <redacted>
> User-Agent: git/2.47.1
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> Pragma: no-cache
> Git-Protocol: version=2

< HTTP/1.1 200 OK
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-upload-pack-advertisement
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Set-Cookie: i_like_gitea=<edited> SameSite=Lax
< Set-Cookie: _csrf=<edited> SameSite=Lax
< X-Frame-Options: SAMEORIGIN
< Date: Thu, 19 Dec 2024 11:09:19 GMT
< Content-Length: 188

Info: Connection #0 to host gitea.localhost left intact
Info: Re-using existing connection with host gitea.localhost
Info: Server auth using Basic with user 'GalaxySnail'

> POST /GalaxySnail/<repo_name>.git/git-upload-pack HTTP/1.1
> Host: gitea.localhost:8080
> Authorization: Basic <redacted>
> User-Agent: git/2.47.1
> Accept-Encoding: deflate, gzip, br, zstd
> Content-Type: application/x-git-upload-pack-request
> Accept: application/x-git-upload-pack-result
> Git-Protocol: version=2
> Content-Length: 102

< HTTP/1.1 307 Temporary Redirect
< Cache-Control: max-age=0, private, must-revalidate, no-transform
< Location: /shared/<repo_name>/git-upload-pack
< Set-Cookie: i_like_gitea=<edited> SameSite=Lax
< Set-Cookie: _csrf=<edited> SameSite=Lax
< X-Frame-Options: SAMEORIGIN
< Date: Thu, 19 Dec 2024 11:09:20 GMT
< Content-Length: 0

Info: Connection #0 to host gitea.localhost left intact
error: RPC failed; HTTP 307 curl 22 The requested URL returned error: 307
fatal: expected flush after ref listing
@GalaxySnail commented on GitHub (Dec 19, 2024): I tried it over ssh tunnel without any reverse proxy, and the result is still the same. <details> ``` Info: Couldn't find host gitea.localhost in the .netrc file; using defaults Info: Host gitea.localhost:8080 was resolved. Info: IPv6: ::1 Info: IPv4: 127.0.0.1 Info: Trying [::1]:8080... Info: Connected to gitea.localhost (::1) port 8080 Info: using HTTP/1.x > GET /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack HTTP/1.1 > Host: gitea.localhost:8080 > User-Agent: git/2.47.1 > Accept: */* > Accept-Encoding: deflate, gzip, br, zstd > Pragma: no-cache > Git-Protocol: version=2 Info: Request completely sent off < HTTP/1.1 401 Unauthorized < Cache-Control: max-age=0, private, must-revalidate, no-transform < Content-Type: text/plain; charset=utf-8 < Set-Cookie: i_like_gitea=<edited> SameSite=Lax < Set-Cookie: _csrf=<edited> SameSite=Lax < Www-Authenticate: Basic realm="Gitea" < X-Content-Type-Options: nosniff < X-Frame-Options: SAMEORIGIN < Date: Thu, 19 Dec 2024 11:09:15 GMT < Content-Length: 13 Info: Connection #0 to host gitea.localhost left intact Info: Re-using existing connection with host gitea.localhost Info: Server auth using Basic with user 'GalaxySnail' > GET /GalaxySnail/<repo_name>.git/info/refs?service=git-upload-pack HTTP/1.1 > Host: gitea.localhost:8080 > Authorization: Basic <redacted> > User-Agent: git/2.47.1 > Accept: */* > Accept-Encoding: deflate, gzip, br, zstd > Pragma: no-cache > Git-Protocol: version=2 < HTTP/1.1 307 Temporary Redirect < Cache-Control: max-age=0, private, must-revalidate, no-transform < Content-Type: text/html; charset=utf-8 < Location: /shared/<repo_name>/info/refs?service=git-upload-pack < Set-Cookie: i_like_gitea=<edited> SameSite=Lax < Set-Cookie: _csrf=<edited> SameSite=Lax < X-Frame-Options: SAMEORIGIN < Date: Thu, 19 Dec 2024 11:09:19 GMT < Content-Length: 93 Info: Connection #0 to host gitea.localhost left intact Info: Issue another request to this URL: 'http://GalaxySnail:<password>@gitea.localhost:8080/shared/<repo_name>/info/refs?service=git-upload-pack' Info: Re-using existing connection with host gitea.localhost Info: Server auth using Basic with user 'GalaxySnail' > GET /shared/<repo_name>/info/refs?service=git-upload-pack HTTP/1.1 > Host: gitea.localhost:8080 > Authorization: Basic <redacted> > User-Agent: git/2.47.1 > Accept: */* > Accept-Encoding: deflate, gzip, br, zstd > Pragma: no-cache > Git-Protocol: version=2 < HTTP/1.1 200 OK < Cache-Control: no-cache, max-age=0, must-revalidate < Content-Type: application/x-git-upload-pack-advertisement < Expires: Fri, 01 Jan 1980 00:00:00 GMT < Pragma: no-cache < Set-Cookie: i_like_gitea=<edited> SameSite=Lax < Set-Cookie: _csrf=<edited> SameSite=Lax < X-Frame-Options: SAMEORIGIN < Date: Thu, 19 Dec 2024 11:09:19 GMT < Content-Length: 188 Info: Connection #0 to host gitea.localhost left intact Info: Re-using existing connection with host gitea.localhost Info: Server auth using Basic with user 'GalaxySnail' > POST /GalaxySnail/<repo_name>.git/git-upload-pack HTTP/1.1 > Host: gitea.localhost:8080 > Authorization: Basic <redacted> > User-Agent: git/2.47.1 > Accept-Encoding: deflate, gzip, br, zstd > Content-Type: application/x-git-upload-pack-request > Accept: application/x-git-upload-pack-result > Git-Protocol: version=2 > Content-Length: 102 < HTTP/1.1 307 Temporary Redirect < Cache-Control: max-age=0, private, must-revalidate, no-transform < Location: /shared/<repo_name>/git-upload-pack < Set-Cookie: i_like_gitea=<edited> SameSite=Lax < Set-Cookie: _csrf=<edited> SameSite=Lax < X-Frame-Options: SAMEORIGIN < Date: Thu, 19 Dec 2024 11:09:20 GMT < Content-Length: 0 Info: Connection #0 to host gitea.localhost left intact error: RPC failed; HTTP 307 curl 22 The requested URL returned error: 307 fatal: expected flush after ref listing ``` </details>
Author
Owner

@GiteaBot commented on GitHub (Jan 19, 2025):

We close issues that need feedback from the author if there were no new comments for a month. 🍵

@GiteaBot commented on GitHub (Jan 19, 2025): We close issues that need feedback from the author if there were no new comments for a month. :tea:
Author
Owner

@GalaxySnail commented on GitHub (Jan 19, 2025):

not stale

@GalaxySnail commented on GitHub (Jan 19, 2025): not stale
Author
Owner

@maxsargentdev commented on GitHub (Feb 11, 2025):

Hey Guys,

Just bumped into this, I resolved it by setting this setting:

git config --global http.followRedirects true

This might be the difference people are seeing.

@maxsargentdev commented on GitHub (Feb 11, 2025): Hey Guys, Just bumped into this, I resolved it by setting [this setting](https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpfollowRedirects): git config --global http.followRedirects true This might be the difference people are seeing.
Author
Owner

@lunny commented on GitHub (Feb 11, 2025):

Hey Guys,

Just bumped into this, I resolved it by setting this setting:

git config --global http.followRedirects true

This might be the difference people are seeing.

In the server side or client side?

@lunny commented on GitHub (Feb 11, 2025): > Hey Guys, > > Just bumped into this, I resolved it by setting [this setting](https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpfollowRedirects): > > git config --global http.followRedirects true > > This might be the difference people are seeing. In the server side or client side?
Author
Owner

@maxsargentdev commented on GitHub (Feb 11, 2025):

Hey Guys,

Just bumped into this, I resolved it by setting this setting:

git config --global http.followRedirects true

This might be the difference people are seeing.

In the server side or client side?

Client side 👍

@maxsargentdev commented on GitHub (Feb 11, 2025): > > Hey Guys, > > > > Just bumped into this, I resolved it by setting [this setting](https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpfollowRedirects): > > > > git config --global http.followRedirects true > > > > This might be the difference people are seeing. > > In the server side or client side? Client side 👍
Author
Owner

@lunny commented on GitHub (Feb 11, 2025):

@maxsargentdev Thank you for the workaround.

@lafriks can you confirm this resolved your problem?

@lunny commented on GitHub (Feb 11, 2025): @maxsargentdev Thank you for the workaround. @lafriks can you confirm this resolved your problem?
Author
Owner

@GiteaBot commented on GitHub (Mar 13, 2025):

We close issues that need feedback from the author if there were no new comments for a month. 🍵

@GiteaBot commented on GitHub (Mar 13, 2025): We close issues that need feedback from the author if there were no new comments for a month. :tea:
Author
Owner

@newgreenshoot commented on GitHub (Mar 14, 2025):

Though that config option works around the issue, this is still a regression in Gitea since previous versions (as well as Github and Gitlab) don't require it to be set for Git clients to act on renamed repositories.

Why is it returning 307 instead of 301? At a glance, it seems like Git will always follow a 301 "Moved Permanently" but it won't follow a 302 or 307 by default, hence the need for setting http.followRedirects client-side.

Could this issue be reopened, again?

@newgreenshoot commented on GitHub (Mar 14, 2025): Though that config option works around the issue, this is still a regression in Gitea since previous versions (as well as Github and Gitlab) don't require it to be set for Git clients to act on renamed repositories. Why is it returning 307 instead of 301? At a glance, it seems like Git will always follow a 301 "Moved Permanently" but it won't follow a 302 or 307 by default, hence the need for setting http.followRedirects client-side. Could this issue be reopened, again?
Author
Owner

@lunny commented on GitHub (Mar 14, 2025):

The status code changed from #18063, maybe we can change it back.

@lunny commented on GitHub (Mar 14, 2025): The status code changed from #18063, maybe we can change it back.
Author
Owner

@lafriks commented on GitHub (Mar 25, 2025):

I think for git client requests it should be changed back

@lafriks commented on GitHub (Mar 25, 2025): I think for git client requests it should be changed back
Author
Owner

@silverwind commented on GitHub (Mar 25, 2025):

Why is it returning 307 instead of 301? At a glance, it seems like Git will always follow a 301 "Moved Permanently" but it won't follow a 302 or 307 by default, hence the need for setting http.followRedirects client-side.

Where is this info from? Did you dig it out of git source code? The docs on followRedirects makes no mention of any status codes.

@silverwind commented on GitHub (Mar 25, 2025): > Why is it returning 307 instead of 301? At a glance, it seems like Git will always follow a 301 "Moved Permanently" but it won't follow a 302 or 307 by default, hence the need for setting http.followRedirects client-side. Where is this info from? Did you dig it out of git source code? The [docs on `followRedirects` ](https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpfollowRedirects) makes no mention of any status codes.
Author
Owner

@silverwind commented on GitHub (Mar 25, 2025):

Digging deeper, the default option seems to map to CURLOPT_FOLLOWLOCATION=0, but alas, curl docs only say that 0 means disabled, e.g. I would assume 0 would not follow any redirects.

@silverwind commented on GitHub (Mar 25, 2025): Digging deeper, the default option seems to map to [CURLOPT_FOLLOWLOCATION=0](https://curl.se/libcurl/c/CURLOPT_FOLLOWLOCATION.html), but alas, curl docs only say that 0 means disabled, e.g. I would assume 0 would not follow any redirects.
Author
Owner

@newgreenshoot commented on GitHub (Mar 26, 2025):

I'm not sure that commit solved it. Old Reddit threads suggested it didn't handle 307s well, but in practice, it seems to treat them the same. Bad hunch on my part, I should've tested it more carefully before publicly guessing.

It's worth stressing that other projects had this issue before after Git stopped following redirects by default, see https://github.com/niemeyer/gopkg/issues/50

Additionally, Git should (with its default configuration!) still be able to fetch a renamed repo:

Git will follow redirects only for the initial request to a remote, but not for subsequent follow-up HTTP requests. Since git uses the redirected URL as the base for the follow-up requests, this is generally sufficient.[1]

I mentioned before that my team bisected this issue to being introduced in https://github.com/go-gitea/gitea/pull/27875. Given that this issue only happens on instances with REQUIRE_SIGNIN_VIEW set, it's surely related to the change introduced in "send 401 first if http requires login"?

@newgreenshoot commented on GitHub (Mar 26, 2025): I'm not sure that commit solved it. Old Reddit threads suggested it didn't handle 307s well, but in practice, it seems to treat them the same. Bad hunch on my part, I should've tested it more carefully before publicly guessing. It's worth stressing that other projects had this issue before after Git stopped following redirects by default, see https://github.com/niemeyer/gopkg/issues/50 Additionally, Git should (with its default configuration!) still be able to fetch a renamed repo: > Git will follow redirects only for the initial request to a remote, but not for subsequent follow-up HTTP requests. Since git uses the redirected URL as the base for the follow-up requests, this is generally sufficient.[[1]](https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpfollowRedirects) I mentioned before that my team bisected this issue to being introduced in https://github.com/go-gitea/gitea/pull/27875. Given that this issue only happens on instances with REQUIRE_SIGNIN_VIEW set, it's surely related to the change introduced in "send 401 first if http requires login"?
Author
Owner

@wxiaoguang commented on GitHub (Mar 26, 2025):

Hmm, yes, it seems that #27875 just copied the code and there is no comment to explain why.

Now the "askAuth" logic just duplicates @lunny

Image

Image

@wxiaoguang commented on GitHub (Mar 26, 2025): Hmm, yes, it seems that #27875 just copied the code and there is no comment to explain why. Now the "askAuth" logic just duplicates @lunny ![Image](https://github.com/user-attachments/assets/ef04bdc6-4f0e-41cf-bac3-e0517981b481) ![Image](https://github.com/user-attachments/assets/c36a2570-7fe2-496f-919c-f0576a9b1f12)
Author
Owner

@lunny commented on GitHub (Mar 27, 2025):

I sent #34032 which is an improvement of #27875 . I don't know whether it will fix this problem.

@lunny commented on GitHub (Mar 27, 2025): I sent #34032 which is an improvement of #27875 . I don't know whether it will fix this problem.
Author
Owner

@wxiaoguang commented on GitHub (Mar 27, 2025):

I sent #34032 which is an improvement of #27875 . I don't know whether it will fix this problem.

Could you reproduce it on your side and/or add some tests?

@wxiaoguang commented on GitHub (Mar 27, 2025): > I sent [#34032](https://github.com/go-gitea/gitea/pull/34032) which is an improvement of [#27875](https://github.com/go-gitea/gitea/pull/27875) . I don't know whether it will fix this problem. Could you reproduce it on your side and/or add some tests?
Author
Owner

@lunny commented on GitHub (Mar 27, 2025):

I can add a test but I cannot reproduce it in my dev env.

@lunny commented on GitHub (Mar 27, 2025): I can add a test but I cannot reproduce it in my dev env.
Author
Owner

@wxiaoguang commented on GitHub (Mar 27, 2025):

But it can be reproduced, no idea why you can't .....

Behavior before #27875 (git fetch could work)

2025/03/27 15:48:01 HTTPRequest [I] router: completed GET /test1/68.git/info/refs?service=git-upload-pack for [::1]:57112, 301 Moved Permanently in 9.0ms @ repo/githttp.go:517(repo.GetInfoRefs)
2025/03/27 15:48:01 HTTPRequest [I] router: completed GET /test1/68-renamed/info/refs?service=git-upload-pack for [::1]:57112, 401 Unauthorized in 4.9ms @ repo/githttp.go:517(repo.GetInfoRefs)
2025/03/27 15:48:01 HTTPRequest [I] router: completed GET /test1/68-renamed/info/refs?service=git-upload-pack for [::1]:57112, 200 OK in 102.9ms @ repo/githttp.go:517(repo.GetInfoRefs)
2025/03/27 15:48:01 HTTPRequest [I] router: completed POST /test1/68-renamed/git-upload-pack for [::1]:57112, 200 OK in 71.5ms @ repo/githttp.go:477(repo.ServiceUploadPack)

Behavior after #27875 (git fetch doesn't work)

2025/03/27 15:48:44 HTTPRequest [I] router: completed GET /test1/68.git/info/refs?service=git-upload-pack for [::1]:57231, 401 Unauthorized in 0.5ms @ web/githttp.go:16(web.addOwnerRepoGitHTTPRouters)
2025/03/27 15:48:45 HTTPRequest [I] router: completed GET /test1/68.git/info/refs?service=git-upload-pack for [::1]:57231, 301 Moved Permanently in 103.0ms @ repo/githttp.go:517(repo.GetInfoRefs)
2025/03/27 15:48:45 HTTPRequest [I] router: completed GET /test1/68-renamed/info/refs?service=git-upload-pack for [::1]:57231, 200 OK in 67.6ms @ repo/githttp.go:517(repo.GetInfoRefs)
2025/03/27 15:48:45 HTTPRequest [I] router: completed POST /test1/68.git/git-upload-pack for [::1]:57231, 301 Moved Permanently in 61.2ms @ repo/githttp.go:477(repo.ServiceUploadPack)

Your PR #34032 is not right, it still behaves as "Behavior after #27875 (git fetch doesn't work)"

@wxiaoguang commented on GitHub (Mar 27, 2025): But it can be reproduced, no idea why you can't ..... Behavior before #27875 (`git fetch` could work) ```` 2025/03/27 15:48:01 HTTPRequest [I] router: completed GET /test1/68.git/info/refs?service=git-upload-pack for [::1]:57112, 301 Moved Permanently in 9.0ms @ repo/githttp.go:517(repo.GetInfoRefs) 2025/03/27 15:48:01 HTTPRequest [I] router: completed GET /test1/68-renamed/info/refs?service=git-upload-pack for [::1]:57112, 401 Unauthorized in 4.9ms @ repo/githttp.go:517(repo.GetInfoRefs) 2025/03/27 15:48:01 HTTPRequest [I] router: completed GET /test1/68-renamed/info/refs?service=git-upload-pack for [::1]:57112, 200 OK in 102.9ms @ repo/githttp.go:517(repo.GetInfoRefs) 2025/03/27 15:48:01 HTTPRequest [I] router: completed POST /test1/68-renamed/git-upload-pack for [::1]:57112, 200 OK in 71.5ms @ repo/githttp.go:477(repo.ServiceUploadPack) ```` Behavior after #27875 (`git fetch` doesn't work) ```` 2025/03/27 15:48:44 HTTPRequest [I] router: completed GET /test1/68.git/info/refs?service=git-upload-pack for [::1]:57231, 401 Unauthorized in 0.5ms @ web/githttp.go:16(web.addOwnerRepoGitHTTPRouters) 2025/03/27 15:48:45 HTTPRequest [I] router: completed GET /test1/68.git/info/refs?service=git-upload-pack for [::1]:57231, 301 Moved Permanently in 103.0ms @ repo/githttp.go:517(repo.GetInfoRefs) 2025/03/27 15:48:45 HTTPRequest [I] router: completed GET /test1/68-renamed/info/refs?service=git-upload-pack for [::1]:57231, 200 OK in 67.6ms @ repo/githttp.go:517(repo.GetInfoRefs) 2025/03/27 15:48:45 HTTPRequest [I] router: completed POST /test1/68.git/git-upload-pack for [::1]:57231, 301 Moved Permanently in 61.2ms @ repo/githttp.go:477(repo.ServiceUploadPack) ```` ---- Your PR #34032 is not right, it still behaves as "Behavior after #27875 (`git fetch` doesn't work)"
Author
Owner

@wxiaoguang commented on GitHub (Mar 27, 2025):

The correct fix should be like this: Fix git client accessing renamed repo #34034

@wxiaoguang commented on GitHub (Mar 27, 2025): The correct fix should be like this: Fix git client accessing renamed repo #34034
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12200