Gitea shows ssh url identical to the https url

Hello,

I just installed Gitea (from the Debian package – Debian version 1.3.2+dfsg-3, which is based on version 1.3.2 of Gitea), and it was quite easy to install.

Now, there is one thing that didn’t work: I logged in, created a repository (repo) and the web interface showed me this HTTPS URL:

https://gitea.myhost.domain/my-user/repo.git

Which is good (I could clone the repo from that URL, using my user and password).

But if I click on “SSH”, it doesn’t change the URL shown.

However, if I use this:

gitea@gitea.myhost.domain:my-user/repo.git

I can access the repository via ssh without problems.

So it seems that something got wrong in the web interface. Did I configure something wrong? The server is behind a reverse http proxy (Apache), so ROOT_URL is the external url, different from DOMAIN (but on the same host). This is what I have in app.ini:

ROOT             = /var/lib/gitea/repositories
PROTOCOL         = http
SSH_DOMAIN       = %(DOMAIN)s
DOMAIN           = myhost.domain
HTTP_PORT        = 3000
LOCAL_ROOT_URL   = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/
ROOT_URL         = https://somewhere:3000
DISABLE_SSH      = false
START_SSH_SERVER = false
SSH_PORT         = 22
OFFLINE_MODE     = false

I’d like to know if I got something misconfigured before report any bugs (in the Debian BTS or in Gitea Github page).

Is there any other information that may be needed to debug this?

Thank you!

ROOT_URL should still be the URL you expose for Gitea - not the one you make apache do reverse proxying to.

Do you have sections in your app.ini? You seem to be missing them, gitea is probably running using the defaults in may cases. ROOT should go under [repository], PROTOCOL under [server]. Here’s the doc. If you want a template of how it should look like, here you go:

APP_NAME = Gitea
RUN_USER = howl
RUN_MODE = dev

[security]
INTERNAL_TOKEN = Stripped
INSTALL_LOCK   = true
SECRET_KEY     = Stripped

[database]
DB_TYPE  = mysql
HOST     = 127.0.0.1:3306
NAME     = gitea
USER     = root
PASSWD   =
SSL_MODE = disable
PATH     = data/gitea.db

[repository]
ROOT = /home/howl/gitea-repositories

[server]
SSH_DOMAIN       = localhost
DOMAIN           = localhost
HTTP_PORT        = 3000
ROOT_URL         = http://localhost:3000/
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = false
OFFLINE_MODE     = false

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
DISABLE_REGISTRATION              = false
ENABLE_CAPTCHA                    = false
REQUIRE_SIGNIN_VIEW               = true
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = noreply.example.org

[picture]
DISABLE_GRAVATAR        = false
ENABLE_FEDERATED_AVATAR = false

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[session]
PROVIDER = file

[indexer]
REPO_INDEXER_ENABLED = true

[log]
MODE      = file
LEVEL     = Warning
ROOT_PATH = /home/howl/go/src/code.gitea.io/gitea/log

[attachment]
MAX_SIZE = 40

(This is what I use in my dev environment - you may want to tweak some parts)

Oh, wait. My ROOT_URL does not have the :3000 port. Sorry, that was a spurious paste. It is more like

DOMAIN      = myhost.domain
HTTP_PORT        = 3000
ROOT_URL = https://myhost.mydomain

So, ROOT_URL is indeed the URL I expose for Gitea. (the reverse proxying redirects from HTTPS to Gitea listening on 3000).

I changed the default ROOT_URL because, as the docs say, it’s supposed to be used “the internal and the external URL don’t match (e.g. in Docker)”.

Yes, my config has sections, but I only copied the parts that I thought were relevant. Should I paste the full config here?

Hmm, let’s try something else first. Can you try to do view source on the repository page and look for <input id="repo-clone-url"? Can you paste the html of that part of the page here? (I want to see if the ssh link is somewhere and it just can’t be shown, if the ssh clone link is also an https link in the code or if it’s actually not rendered by the template)

Oh, here it is:

                                    <div class="ui action tiny input" id="clone-panel">
					<button class="ui basic clone button" id="repo-clone-https" data-link="https://gitea.server.info/jcp/myrepo.git">
						HTTPS
					</button>
					<button class="ui basic clone button" id="repo-clone-ssh" data-link="gitea@gitea.server.info:jcp/myrepo.git">
						SSH
					</button>
					<input id="repo-clone-url" value="https://gitea.server.info/jcp/myrepo.git" readonly>
					<button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="Copy" data-success="Copied!" data-error="Press ⌘-C or Ctrl-C to copy" data-content="Copy" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url">
						<i class="octicon octicon-clippy"></i>
					</button>
				<div class="ui basic jump dropdown icon button poping up" data-content="Download this repository" data-variation="tiny inverted" data-position="top right">
					<i class="download icon"></i>
					<div class="menu">
						<a class="item" href="/jcp/myrepo/archive/master.zip"><i class="octicon octicon-file-zip"></i> ZIP</a>
						<a class="item" href="/jcp/myrepo/archive/master.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
					</div>
				</div>
			</div>

So both URLs are there… But the button isn’t switching from https to ssh… (?)

Can you open up your browser’s console and check if there are any errors? Can you try with another browser?

Well – the same happens in both Firefox and Google Chrome (in both of them the URL doesn’t change when I click on SSH).

Yes, there is an error on the console:

jQuery.Deferred exception: $(...).autolink is not a function @https://gitea.aleph0.info/js/index.js?v=7e44814bfdf3ce36777acbb3e58614bb:1473:5
mightThrow@https://gitea.aleph0.info/vendor/plugins/jquery/jquery.min.js:2:15531
resolve/</process<@https://gitea.aleph0.info/vendor/plugins/jquery/jquery.min.js:2:16200
 undefined

This is from FF; the same error shows up in Chrome:

jquery.min.js:2 jQuery.Deferred exception: $(...).autolink is not a function TypeError: $(...).autolink is not a function
    at HTMLDocument.<anonymous> (https://gitea.aleph0.info/js/index.js?v=7e44814…:1473:20)
    at mightThrow (https://gitea.aleph0.info/vendor/plugins/jquery/jquery.min.js:2:15539)
    at process (https://gitea.aleph0.info/vendor/plugins/jquery/jquery.min.js:2:16200) undefined
jquery.min.js:2 Uncaught TypeError: $(...).autolink is not a function
    at HTMLDocument.<anonymous> (index.js?v=7e44814bf…7acbb3e58614bb:1473)
    at mightThrow (jquery.min.js:2)
    at process (jquery.min.js:2)

I also tried building from git master, and then nothing wrong happens – so I suppose this is a problem with either the Debian package, or the version that they have packaged (which is outdated anyway).

So, it seems to be up to the Debian maintainer to update and fix the package.

However – I would rather run packaged software instead of running from source, so if this is something that can be trivially fixed, I would be interested in the solution (so I’d stick to the Debian package).

Thanks a lot for your help!
J.

I think you need to install the gitea-common package. I’m no expert about the debian package though. The maintainer gave up on it in february iirc.

gitea-common is already installed… I’ll consider switching to a locally-compiled version.

Thank you for answering!

1 Like