wrong ssh url after changing to default ssh port 22 #1645

Closed
opened 2025-11-02 04:08:15 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @waozixyz on GitHub (Mar 22, 2018).

  • Gitea version (or commit ref):
  • Git version: a2a49c9
  • Operating system: armbian (debian for arm devices)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No (is the try.gitea.io server down?)
    • Not relevant

Description

I used to use a 4 digit port number like 3434 so the ssh url for repositories would be
git@ukuvota.world:3434/ukuvota/website.git
I then switched the port number in the app.ini file from 3434 to 22 the default port for ssh and the ssh url for repositories is now
git@ukuvota.world:ukuvota/website.git
which does not work -> it should be
git@ukuvota.world/ukuvota/website.git

...

Screenshots

Originally created by @waozixyz on GitHub (Mar 22, 2018). - Gitea version (or commit ref): - Git version: a2a49c9 - Operating system: armbian (debian for arm devices) - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No (is the try.gitea.io server down?) - [ ] Not relevant ## Description I used to use a 4 digit port number like 3434 so the ssh url for repositories would be git@ukuvota.world:3434/ukuvota/website.git I then switched the port number in the app.ini file from 3434 to 22 the default port for ssh and the ssh url for repositories is now git@ukuvota.world:ukuvota/website.git which does not work -> it should be git@ukuvota.world/ukuvota/website.git ... ## Screenshots ![](https://screenshotscdn.firefoxusercontent.com/images/bb0373f9-de3d-4412-bd1f-fa0dca9876d2.png)
GiteaMirror added the type/question label 2025-11-02 04:08:15 -06:00
Author
Owner

@lunny commented on GitHub (Mar 22, 2018):

but
image

@lunny commented on GitHub (Mar 22, 2018): but ![image](https://user-images.githubusercontent.com/81045/37779293-0bda64b2-2e27-11e8-80dd-21f6eabdc8d2.png)
Author
Owner

@lafriks commented on GitHub (Mar 22, 2018):

In git correct ssh url for port 3434 should be ssh://git@ukuvota.world:3434/ukuvota/website.git

@lafriks commented on GitHub (Mar 22, 2018): In git correct ssh url for port `3434` should be `ssh://git@ukuvota.world:3434/ukuvota/website.git`
Author
Owner

@waozixyz commented on GitHub (Mar 22, 2018):

@lafriks well i changed the port from 3434 to 20

@waozixyz commented on GitHub (Mar 22, 2018): @lafriks well i changed the port from 3434 to 20
Author
Owner

@waozixyz commented on GitHub (Mar 22, 2018):

okay so this is strange, im not sure how related this is to gitea.

So when i clone the repo using the url gitea give me

git@ukuvota.world:ukuvota/website.git

it work just fine,

however if i use the already cloned version and have this url in the .git/config i get the following error

ssh: Could not resolve hostname ukuvota.world:ukuvota: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

the corresponding .git/config is:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = ssh://git@ukuvota.world:ukuvota/website.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

however when i change the url from:
ssh://git@ukuvota.world:ukuvota/website.git
to
ssh://git@ukuvota.world/ukuvota/website.git

it works just fine.

its not really a big issue since i can just use the freshly cloned version without this strange bug, but still confusing why this is happening

@lafriks @lunny

@waozixyz commented on GitHub (Mar 22, 2018): okay so this is strange, im not sure how related this is to gitea. So when i clone the repo using the url gitea give me ``` git@ukuvota.world:ukuvota/website.git ``` it work just fine, however if i use the already cloned version and have this url in the .git/config i get the following error ``` ssh: Could not resolve hostname ukuvota.world:ukuvota: Name or service not known fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` the corresponding .git/config is: ``` [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = ssh://git@ukuvota.world:ukuvota/website.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master ``` however when i change the url from: ssh://git@ukuvota.world:ukuvota/website.git to ssh://git@ukuvota.world/ukuvota/website.git it works just fine. its not really a big issue since i can just use the freshly cloned version without this strange bug, but still confusing why this is happening @lafriks @lunny
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1645