Error during Gitea 1.21.x upgrade Add RemoteAddress to mirrors failed No such remote 'origin' #12468

Closed
opened 2025-11-02 10:10:45 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @tuzhis on GitHub (Feb 11, 2024).

Description

I encountered an error while upgrading Gitea from version 1.20.x to 1.21.x. the upgrade process fails with an error message, whereas the previous version (1.20.x) was working fine.

routers/init.go:69:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: migrate: migration[276]: Add RemoteAddress to mirrors failed: get remote origin's address of xxx/xxx-sales failed: exit status 2 - error: No such remote 'origin'
 - error: No such remote 'origin'

Gitea Version

1.21.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?

docker

Database

MySQL/MariaDB

Originally created by @tuzhis on GitHub (Feb 11, 2024). ### Description I encountered an error while upgrading Gitea from version 1.20.x to 1.21.x. the upgrade process fails with an error message, whereas the previous version (1.20.x) was working fine. ``` routers/init.go:69:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: migrate: migration[276]: Add RemoteAddress to mirrors failed: get remote origin's address of xxx/xxx-sales failed: exit status 2 - error: No such remote 'origin' - error: No such remote 'origin' ``` ### Gitea Version 1.21.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? docker ### Database MySQL/MariaDB
GiteaMirror added the type/bug label 2025-11-02 10:10:46 -06:00
Author
Owner

@go-compile commented on GitHub (Feb 16, 2024):

I'm experiencing the same issue, however I beleive I have found a solution. By navigating to your Gitea's repositories folder and manually adding a remote origin with the name "origin" this resolves the issue. I believe the issue is caused by mirrors without a remote address.

Steps to resolution

  1. Open a terminal on your server and using Docker logs find the repository which is throwing the error (e.g. "xxx/xxx-sales").
  2. Find and navigate to the location gitea/git/repositories (relative to your Gitea volume).
  3. Open the repository which is throwing an error and add a remote with the name origin git remote add origin https://github.com/xxx/xxx.
  4. Repeat from step 1 until no more errors show.
@go-compile commented on GitHub (Feb 16, 2024): I'm experiencing the same issue, however I beleive I have found a solution. By navigating to your Gitea's repositories folder and **manually adding a remote origin** with the name "origin" this resolves the issue. I believe the issue is **caused by mirrors without a remote address**. ### Steps to resolution 1. Open a terminal on your server and using Docker logs find the repository which is throwing the error (e.g. "xxx/xxx-sales"). 2. Find and navigate to the location `gitea/git/repositories` (relative to your Gitea volume). 3. Open the repository which is throwing an error and add a remote with the name origin `git remote add origin https://github.com/xxx/xxx`. 4. Repeat from step 1 until no more errors show.
Author
Owner

@delvh commented on GitHub (Feb 16, 2024):

Yes, that's exactly what the error means.
The only weird thing is that there are mirrors without origin in the first place.
This should not be possible…

@delvh commented on GitHub (Feb 16, 2024): Yes, that's exactly what the error means. The only weird thing is that there are mirrors without `origin` in the first place. This should not be possible…
Author
Owner

@go-compile commented on GitHub (Feb 16, 2024):

Yes, that's exactly what the error means. The only weird thing is that there are mirrors without origin in the first place. This should not be possible…

In my case I had to fix a broken Gitea instance by manually placing repository files and adopting them, among other things; all of which were done many months ago. This is likely the cause.

@go-compile commented on GitHub (Feb 16, 2024): > Yes, that's exactly what the error means. The only weird thing is that there are mirrors without `origin` in the first place. This should not be possible… In my case I had to fix a broken Gitea instance by manually placing repository files and adopting them, among other things; all of which were done many months ago. This is likely the cause.
Author
Owner

@tuzhis commented on GitHub (Feb 16, 2024):

2. gitea/git/repositories

I'm experiencing the same issue, however I beleive I have found a solution. By navigating to your Gitea's repositories folder and manually adding a remote origin with the name "origin" this resolves the issue. I believe the issue is caused by mirrors without a remote address.

Steps to resolution

  1. Open a terminal on your server and using Docker logs find the repository which is throwing the error (e.g. "xxx/xxx-sales").
  2. Find and navigate to the location gitea/git/repositories (relative to your Gitea volume).
  3. Open the repository which is throwing an error and add a remote with the name origin git remote add origin https://github.com/xxx/xxx.
  4. Repeat from step 1 until no more errors show.

@go-compile @delvh thank you for the response, everything is working properly after adding all the remotes.
previously, I thought it was a bug because there was no "origin" in any of the repository under the gitea/git/repositories path.

@tuzhis commented on GitHub (Feb 16, 2024): > 2\. gitea/git/repositories > I'm experiencing the same issue, however I beleive I have found a solution. By navigating to your Gitea's repositories folder and **manually adding a remote origin** with the name "origin" this resolves the issue. I believe the issue is **caused by mirrors without a remote address**. > > ### Steps to resolution > 1. Open a terminal on your server and using Docker logs find the repository which is throwing the error (e.g. "xxx/xxx-sales"). > 2. Find and navigate to the location `gitea/git/repositories` (relative to your Gitea volume). > 3. Open the repository which is throwing an error and add a remote with the name origin `git remote add origin https://github.com/xxx/xxx`. > 4. Repeat from step 1 until no more errors show. @go-compile @delvh thank you for the response, everything is working properly after adding all the remotes. previously, I thought it was a bug because there was no "origin" in any of the repository under the `gitea/git/repositories` path.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 28, 2024):

Automatically locked because of our CONTRIBUTING guidelines

@github-actions[bot] commented on GitHub (Feb 28, 2024): Automatically locked because of our [CONTRIBUTING guidelines](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#issue-locking)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12468