tea doesn't understand ssh URL as displayed by Gitea #431

Closed
opened 2 months ago by jotoho · 2 comments
jotoho commented 2 months ago

I have a personal Gitea instance installed on a Raspberry Pi at home as a docker container which I am using to manage my own Git repositories.

To avoid a conflict with the SSH daemon running on the host, I assigned Gitea's built-in sshd a non-default port (2222) both on docker and in the Gitea configuration. Because the usual syntax (git@gitea.jotoho.de:jotoho/somerepo.git) would cause git to connect with the wrong daemon, Gitea correctly displays the SSH URL as ssh://git@gitea.jotoho.de:2222/jotoho/somerepo.git.

This works in Git but after upgrading from tea 0.7.1 to 0.8.0, I noticed that tea now fails to correctly determine the location of the repository from the origin remote. Using gitea.jotoho.de:jotoho/somerepo.git as the remote URL by configuring gitea.jotoho.de's user and port in the SSH config works as expected but this requires an additional step (making the config entry) and results in a situation where the URL dispensed by Gitea is incompatible with tea.

Because of this I would request that support for ssh://-URLs be (re-)added.

If it would help in making a patch for this, I am willing to provide a temporary account on the instance for debugging/testing purposes and test the PR myself. Unfortunately, I am not familiar with the Go programming language so I can't solve the problem myself.

I have a [personal Gitea instance installed on a Raspberry Pi at home](https://gitea.jotoho.de) as a docker container which I am using to manage my own Git repositories. To avoid a conflict with the SSH daemon running on the host, I assigned Gitea's built-in sshd a non-default port (2222) both on docker and in the Gitea configuration. Because the usual syntax (`git@gitea.jotoho.de:jotoho/somerepo.git`) would cause git to connect with the wrong daemon, Gitea correctly displays the SSH URL as `ssh://git@gitea.jotoho.de:2222/jotoho/somerepo.git`. This works in Git but after upgrading from tea `0.7.1` to `0.8.0`, I noticed that tea now fails to correctly determine the location of the repository from the origin remote. Using `gitea.jotoho.de:jotoho/somerepo.git` as the remote URL by configuring gitea.jotoho.de's user and port in the SSH config works as expected but this requires an additional step (making the config entry) and results in a situation where the URL dispensed by Gitea is incompatible with tea. Because of this I would request that support for `ssh://`-URLs be (re-)added. If it would help in making a patch for this, I am willing to provide a temporary account on the instance for debugging/testing purposes and test the PR myself. Unfortunately, I am not familiar with the Go programming language so I can't solve the problem myself.
Collaborator

This will be a regression from #391, which we forgot to mark as breaking :(
Interesting that this worked for you before 0.8.0, as the report in #380 was about exactly this case not working 🤔

What do you have configured in SSHHost in your tea config? (check with tea logins edit).
You can probably fix this by just changing this value to gitea.jotoho.de:2222. If not, I'll have to look deeper into this

This will be a regression from https://gitea.com/gitea/tea/pulls/391, which we forgot to mark as breaking :( Interesting that this worked for you before 0.8.0, as the report in #380 was about exactly this case not working 🤔 What do you have configured in `SSHHost` in your tea config? (check with `tea logins edit`). You can probably fix this by just changing this value to `gitea.jotoho.de:2222`. If not, I'll have to look deeper into this
Poster

Hey @noerw,

the only changes made between the Gitea URL working and it deciding to break were:

  • Updating tea to 0.8.0 (after informing the archlinux maintainer that the package was outdated and waiting for him to publish the new version to the repo)
  • An automatic Gitea instance upgrade from 1.15.3 to 1.15.4 (current)

I had determined that an issue with the instance upgrade was (extremely) unlikely given the specifics of this problem, so I filed this issue here instead of the Gitea repo.

Changing the ssh host from gitea.jotoho.de to gitea.jotoho.de:2222 inside the tea config makes the URL given by Gitea work.

(It also breaks the trick with the ssh config - presumably since it doesn't recognize the gitea.jotoho.de short-hand as gitea.jotoho.de:2222 but this is good enough for me.)

The change I made to my tea config:

diff --git a/.config/tea/config.yml b/.config/tea/config.yml
index a1018ac..852ef79 100644
--- a/.config/tea/config.yml
+++ b/.config/tea/config.yml
@@ -3,7 +3,7 @@ logins:
       url: https://gitea.jotoho.de
       token: REDACTED
       default: true
-      ssh_host: gitea.jotoho.de
+      ssh_host: gitea.jotoho.de:2222
       ssh_key: /home/jonas/.ssh/id_rsa
       insecure: false
       user: jotoho

The old ssh config entry I keep talking about (~/.ssh/config):

Host gitea.jotoho.de
    Hostname gitea.jotoho.de
    Port 2222
    User git
    PubkeyAuthentication yes
    PasswordAuthentication no

I had chosen gitea.jotoho.de as the name for this host in the configuration (in contrast to something even shorter like gitea) because that used to make both git and tea <0.8.0 happy while still being less typing for me.

Hey @noerw, the only changes made between the Gitea URL working and it deciding to break were: - Updating tea to `0.8.0` (after informing the archlinux maintainer that the package was outdated and waiting for him to publish the new version to the repo) - An automatic Gitea instance upgrade from `1.15.3` to `1.15.4` (current) I had determined that an issue with the instance upgrade was (extremely) unlikely given the specifics of this problem, so I filed this issue here instead of the Gitea repo. Changing the ssh host from `gitea.jotoho.de` to `gitea.jotoho.de:2222` inside the tea config makes the URL given by Gitea work. (It also breaks the trick with the ssh config - presumably since it doesn't recognize the `gitea.jotoho.de` short-hand as `gitea.jotoho.de:2222` but this is good enough for me.) The change I made to my tea config: ```diff diff --git a/.config/tea/config.yml b/.config/tea/config.yml index a1018ac..852ef79 100644 --- a/.config/tea/config.yml +++ b/.config/tea/config.yml @@ -3,7 +3,7 @@ logins: url: https://gitea.jotoho.de token: REDACTED default: true - ssh_host: gitea.jotoho.de + ssh_host: gitea.jotoho.de:2222 ssh_key: /home/jonas/.ssh/id_rsa insecure: false user: jotoho ``` The old ssh config entry I keep talking about (`~/.ssh/config`): ``` Host gitea.jotoho.de Hostname gitea.jotoho.de Port 2222 User git PubkeyAuthentication yes PasswordAuthentication no ``` I had chosen `gitea.jotoho.de` as the name for this host in the configuration (in contrast to something even shorter like `gitea`) because that used to make both git and tea `<0.8.0` happy while still being less typing for me.
jotoho closed this issue 2 months ago
Sign in to join this conversation.
Loading…
There is no content yet.