Skip to content
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

Updating mirror settings of a repository could cause it to lose the token for mirroring #30416

Closed
wolfogre opened this issue Apr 11, 2024 · 3 comments · Fixed by #30429
Closed
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Milestone

Comments

@wolfogre
Copy link
Member

wolfogre commented Apr 11, 2024

Description

Reproduction steps:

  1. Mirror a private repo from GitHub with a token
image
  1. Sync mirror manually and check admin system notices to make sure everything is fine now.
image image
  1. Update the "Mirror Interval", don't touch "Authorization".
image
  1. Sync mirror manually and check admin system notices again.
image

The error log looks like:

Failed to update mirror repository '/var/lib/gitea/data/gitea-repositories/root/test_private_repo.git': fatal: could not read Username for 'https://github.com': terminal prompts disabled

Gitea Version

v1.21.10

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Binary.

Database

PostgreSQL

@wolfogre wolfogre added type/bug topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them labels Apr 11, 2024
@lunny lunny added this to the 1.21.11 milestone Apr 11, 2024
@yp05327
Copy link
Contributor

yp05327 commented Apr 12, 2024

similar to #29904
some options should be handled when edit these settings.

GiteaBot added a commit to GiteaBot/gitea that referenced this issue Apr 13, 2024
Fix go-gitea#30416.

Before (it shows as "Unset" while there's a token):

<img width="980" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a">

After:

<img width="977" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5">

The username shows as "oauth2" because of
https://github.com/go-gitea/gitea/blob/f9fdac9809335729b2ac3227b2a5f71a62fc64ad/services/migrations/dump.go#L99

I have checked that all usage of `MirrorRemoteAddress` has been updated.

<img width="1806" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d">

However, it needs to be checked again when backporting.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
silverwind pushed a commit that referenced this issue Apr 13, 2024
Backport #30429 by @wolfogre

Fix #30416.

Before (it shows as "Unset" while there's a token):

<img width="980" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a">

After:

<img width="977" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5">

The username shows as "oauth2" because of
https://github.com/go-gitea/gitea/blob/f9fdac9809335729b2ac3227b2a5f71a62fc64ad/services/migrations/dump.go#L99

I have checked that all usage of `MirrorRemoteAddress` has been updated.

<img width="1806" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d">

However, it needs to be checked again when backporting.

Co-authored-by: Jason Song <i@wolfogre.com>
@xyziven
Copy link

xyziven commented Apr 13, 2024

At step 3, what happens if touch "Authorization"? Looks like only username/password is allowed here for mirror settings, while github requires access token.
1713050028845

@lunny
Copy link
Member

lunny commented Apr 14, 2024

At step 3, what happens if touch "Authorization"? Looks like only username/password is allowed here for mirror settings, while github requires access token. 1713050028845

Then the token will be filled into password and username will a generated name. I think this place needs a refactor in future.

lunny pushed a commit to lunny/gitea that referenced this issue Apr 14, 2024
Fix go-gitea#30416.

Before (it shows as "Unset" while there's a token):

<img width="980" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a">

After:

<img width="977" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5">

The username shows as "oauth2" because of
https://github.com/go-gitea/gitea/blob/f9fdac9809335729b2ac3227b2a5f71a62fc64ad/services/migrations/dump.go#L99

I have checked that all usage of `MirrorRemoteAddress` has been updated.

<img width="1806" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d">

However, it needs to be checked again when backporting.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
lunny added a commit that referenced this issue Apr 15, 2024
Fix #30416.
Backport #30429 

Before (it shows as "Unset" while there's a token):

<img width="980" alt="image"

src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a">

After:

<img width="977" alt="image"

src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5">

The username shows as "oauth2" because of

https://github.com/go-gitea/gitea/blob/f9fdac9809335729b2ac3227b2a5f71a62fc64ad/services/migrations/dump.go#L99

I have checked that all usage of `MirrorRemoteAddress` has been updated.

<img width="1806" alt="image"

src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d">

However, it needs to be checked again when backporting.

Co-authored-by: Jason Song <i@wolfogre.com>
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants