-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Error when pushing to renamed repository #28460
Comments
Did you push to the old name or the new name? |
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. |
When pushing to the old remote url, also by just renaming without changing owner |
What's the expectation? Should it be allowed to redirect to the real repository or should it return the 404? |
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. Please fix! Its a pita to rename an organization with certain number of repos and users without this feature! |
Previously it allowed to push to old remote url and it would still work as it was pushed to new repo location |
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. |
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:
|
@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 |
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: #27875 |
|
gitea: 1.21.5 Running
Same error |
I can confirm the issue. Using Gitea 1.21.7 with docker from the linuxserver.io image. |
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. |
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. |
We have the same issue in 1.21.10. It appears an upgrade will not solve it, is it correct? |
Yes, we are running Gitea behind a reverse proxy (Apache 2.4.58). |
Gitea is running behind a apache proxy. |
Gitea behind swag (NGINX), authentication by Gitea itself for me. |
I encountered this issue, after changing my username. |
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 . |
We close issues that need feedback from the author if there were no new comments for a month. 🍵 |
@lafriks Can you confirm this is still a problem? |
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: ***@***.***>
|
This is still a problem after we upgraded to 1.22.6. We are running gitea behind caddy. |
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? |
The status code changed from #18063, maybe we can change it back. |
I think for git client requests it should be changed back |
Where is this info from? Did you dig it out of git source code? The docs on |
Fix go-gitea#28460 --------- Co-authored-by: wxiaoguang <[email protected]>
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. |
Backport #34005 by lunny Fix #28460 Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
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 niemeyer/gopkg#50 Additionally, Git should (with its default configuration!) still be able to fetch a renamed repo:
I mentioned before that my team bisected this issue to being introduced in #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"? |
I can add a test but I cannot reproduce it in my dev env. |
But it can be reproduced, no idea why you can't ..... Behavior before #27875 (
Behavior after #27875 (
Your PR #34032 is not right, it still behaves as "Behavior after #27875 ( |
The correct fix should be like this: Fix git client accessing renamed repo #34034 |
Fix go-gitea#28460 --------- Co-authored-by: wxiaoguang <[email protected]> (cherry picked from commit 356b707)
Description
When pushing to/pulling from renamed repository there is error:
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
The text was updated successfully, but these errors were encountered: