Bare Metal (Ubuntu/Apache), Reverse Proxy setup - On 'git add remote' via SSH, git expects project/repository name prefixed with '/' ? (OD-1136)
Closed
addiejewoah opened 1 year ago

I'm new to OneDev and I like to try it out on my VPS, since it looks very cool and promising! I have a VPS running the latest versions of Ubuntu, Apache2, MySQL, etc. so I followed the OneDev Bare Metal installation guide and I also set up an Apache VirtualHost proxy so I can have a pretty url using a subdomain. Thus, I also followed the OneDev reverse proxy setup guide to the letter. It took me some additional puzzling and web searches to get the OneDev server software running and authentication configured, but now it works! 😃

I've set the Server Setting to the correct url (e.g. my.example.com), which also updates the server's SSH url to ssh://my.example.com. I added a new project 'test' via the web application GUI and clicked the empty project's 'pushing an existing repository' which shows the SSH link: git remote add origin ssh://my.example.com/test

When I then open a new terminal on my local machine (which is not the remote VPS with the OneDev installation), navigate to my project's git repository and try to push it using the provided 'git add remote' and 'git push' commands, I get the following:

% git remote add origin ssh://my.example.com/test
% git push origin develop
fatal: '/test' does not appear to be a git repository
fatal: Could not read from remote repository.

That prefixed '/' is out of place since it is not part of the project name. So my hunch is something's not right yet with the proxy settings. When I prefix and extra slash to the project name in the 'git add remote' command, git also expects to find a repository with two slashes:

 % git remote add origin ssh://my.example.com//test
 % git push origin develop
 fatal: '//test' does not appear to be a git repository
 fatal: Could not read from remote repository.

This is why I think the proxy settings are messing up the url which git uses to deduct the repository name from... But that's just a guess. And idea where I should look?

For completeness: my proxy settings are still exactly as in the OneDev proxy setup guide.

Robin Shen commented 1 year ago

I guess port 22 of your VPS is not forwarding to SSH port 6611 used by OneDev. Please test with below ssh clone url to see if it works:

ssh://my.example.com:6611/test

addiejewoah commented 1 year ago

Hi Robin, thanks for the fast response. I tried your suggestion with 'git clone' on my local machine, this results in:

% git clone ssh://my.example.com:6611/test
Cloning into 'test'...
ssh: connect to host my.example.com port 6611: Connection timed out
fatal: Could not read from remote repository.

Since you mentioned the SSH port: I do have my VPS' port 22 set up so it is only reachable from my home's ip address (via an apache 'Allow from' directive). Anything trying to connect to port 22 from a different ip-address is rejected. I'll try if I can come up with an 'Allow from' directive which also allows port forwarding on the same host.

addiejewoah commented 1 year ago

Changing the Apache 'Allow from' directive did not help. Opening port 6611 on the firewall did (Captain Hindsight says 'Duh'). Everything git-wise seems to be working now. Thanks for the hint, looking forward to trying this thing out!

Robin Shen commented 1 year ago

Glad to see it is working now. Let me know if you have any other questions. Closing this issue now.

Robin Shen changed state to 'Closed' 1 year ago
Previous Value Current Value
Open
Closed
OneDev referenced from other issue 1 year ago
issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (4)
Reference
OD-1136
Please wait...
Page is in error, reload to recover