Bug: Cannot detect repo automatically even though i am in the repo #528

Open
opened 2023-01-27 10:23:59 +00:00 by v3ss0n · 2 comments

describe your environment

  • tea version used (tea -v): 0.9.1
  • Gitea version used:
    • the issue only occurred after updating gitea recently
  • operating system:
  • I make use of...
    • non-standard default branch names (no main,master, or trunk)
    • .ssh/config or .gitconfig host aliases in my git remotes
    • ssh_agent or similar
    • non-standard ports for gitea and/or ssh (ssh port 3322)
    • something else that's likely to interact badly with tea: ...

describe the issue (observed vs expected behaviour)

Bug: Cannot detect repo automatically even though i am in the repo . i have to set repo by setting --repo.

### describe your environment - tea version used (`tea -v`): 0.9.1 - [x] I also reproduced the issue [with the latest master build](https://dl.gitea.io/tea/master) - Gitea version used: - [ ] the issue only occurred after updating gitea recently - operating system: - I make use of... - [ ] non-standard default branch names (no `main`,`master`, or `trunk`) - [ ] .ssh/config or .gitconfig host aliases in my git remotes - [ ] ssh_agent or similar - [x] non-standard ports for gitea and/or ssh (ssh port 3322) - [ ] something else that's likely to interact badly with tea: ... ### describe the issue (observed vs expected behaviour) Bug: Cannot detect repo automatically even though i am in the repo . i have to set repo by setting --repo.
v3ss0n added the
kind/bug
label 2023-01-27 10:23:59 +00:00

I think this is the relevant part of the code, but haven't dug into working out how to actually fix it, especially since I've not really written any Go before:

5582f92df4/modules/context/context.go (L226)

I *think* this is the relevant part of the code, but haven't dug into working out how to actually fix it, especially since I've not really written any Go before: https://gitea.com/gitea/tea/src/commit/5582f92df4ee2ad29055834ea33941b5edbc0a69/modules/context/context.go#L226

Ah, I just discovered a workaround.
In in my remote for a given repo checkout I had the following:

$ git config --get remote.private.url
ssh://git@git.example.com:2222/mattcen/my-repo

And when I performed a tea login, it did this:

$ tea login list
+-----------------+-------------------------+-----------------+---------+---------+
|      NAME       |           URL           |     SSHHOST     |  USER   | DEFAULT |
+-----------------+-------------------------+-----------------+---------+---------+
| git.example.com | https://git.example.com | git.example.com | mattcen | true    |
+-----------------+-------------------------+-----------------+---------+---------+

All I needed to do was tea login edit and change the ssh_host line to include the port:

@@ -6 +6 @@ logins:
-  ssh_host: git.example.com
+  ssh_host: git.example.com:2222
Ah, I just discovered a workaround. In in my remote for a given repo checkout I had the following: ```bash $ git config --get remote.private.url ssh://git@git.example.com:2222/mattcen/my-repo ``` And when I performed a `tea login`, it did this: ```bash $ tea login list +-----------------+-------------------------+-----------------+---------+---------+ | NAME | URL | SSHHOST | USER | DEFAULT | +-----------------+-------------------------+-----------------+---------+---------+ | git.example.com | https://git.example.com | git.example.com | mattcen | true | +-----------------+-------------------------+-----------------+---------+---------+ ``` All I needed to do was `tea login edit` and change the `ssh_host` line to include the port: ```diff @@ -6 +6 @@ logins: - ssh_host: git.example.com + ssh_host: git.example.com:2222 ```
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/tea#528
No description provided.