Personally, I run gitea with almost 0 intention of letting anyone else onto it. It's specifically for my own projects. It would be nice if the default user's repos were accessible through a slightly shorter url pattern
For example, this isn't really ideal:
git.mylongdomain.com/mylonghandle/mylongusername.com
What might be nicer is:
git.mylongdomain.com/r/mylongusername.com
git.mylongdomain.com/mylongusername.com
Coercing all repos to under that path could be quite handy (maybe leave orgs as-is?). I currently get around this by hosting cgit at the root with a task to populate it based off public repos. Obviously you'd need some protections in place to prevent conflicting with existing URL patterns (static files, settings etc).
In theory this would be as simple as a URL redirect on the router, and updating the repo URLs when presenting them in the UI, I think.
I currently get around this by setting my user's username to u
, but that makes most of the UI look kinda bad.
I realise this is a pretty niche thing, but i'm sure there are other's out there who might find this nice?
I'm searching for the same. +1
Btw, @RealOrangeOne, how to you use this task you coded? I also use cgit - by now, its root is on one organization, the one I want to let public - but I'm curious to test your approach.... ;)
Offtopic, but script works by scraping the public API of the instance, and building a cgit repos list, and having cgit serve from that. this might be a slightly better example.
I think the easiest workaround would be creating an organization with name 'x' and transferring all repos to that organization.
That would also work, and is actually far nicer than my current approach, but still a bit of a bodge
Also:
git.mylongdomain.com/mylonghandle/mylongusername.com
should be
git.mylongdomain.com/mylonghandle/mylongrepositoryname
Why longusername
and why .com
?
Why longusername and why .com?
Typo. My point still stands though, the URLs aren't the nicest.
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
This is still definitely an issue, and IMO still really nice to have!
(Obviously probably isn't the most urgent and highly-demanded request in the world!)
I'm also looking for something like this. I'm using Gitea only for myself and shorter URLs would be a nice thing to have.
For anyone else arriving at this issue, I had the same requirement and have solved it using a reverse proxy (nginx in my case) in front of my gitea
instance. My setup looks roughly like this:
http {
server {
listen 443 ssl;
server_name my.domain;
ssl_certificate /ssl/cert.pem;
ssl_certificate_key /ssl/key.pem;
location / {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_ssl_server_name on;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://gitea:3000/x/;
}
}
server {
listen 443 ssl;
server_name api.my.domain;
ssl_certificate /ssl/cert.pem;
ssl_certificate_key /ssl/key.pem;
location / {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_ssl_server_name on;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://gitea:3000/;
}
}
}
(I'm no nginx expert so it's entirely possible the above could be simplified).
Notice how with the server my.domain, all requests to location /
get routed to http://gitea_3000/x/. I separated out api.my.domain in order that API traffic is directed at http://gitea:3000/
Pretty clever, thanks!
Most helpful comment
This is still definitely an issue, and IMO still really nice to have!
(Obviously probably isn't the most urgent and highly-demanded request in the world!)