Skip to content

Wrong SSH clone URL #3925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 7 tasks
ghost opened this issue May 8, 2018 · 10 comments
Closed
2 of 7 tasks

Wrong SSH clone URL #3925

ghost opened this issue May 8, 2018 · 10 comments

Comments

@ghost
Copy link

ghost commented May 8, 2018

  • Gitea version (or commit ref): 1.3.2
  • Git version: 1:2.11.0-2ubuntu0.3
  • Operating system: Ubuntu-1704
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

When trying to clone over ssh I get following url:

ssh://git@domain:port/user/repo.git

But the repos are located under

ssh://git@domain:port/home/git/user/repo.git

I did not find an option similar to ROOT_URL for ssh. How can I configure gitea to use a custom directory for clone url over ssh without jailing my user and moving the repo root?

Gitea config

RUN_USER = git
[repository]
ROOT = /home/git
[server]
SSH_DOMAIN = domain
DISABLE_SSH = false
SSH_PORT = 22

@daviian
Copy link
Member

daviian commented May 8, 2018

The url seems fine. Gitea handles the mapping between the url and the actual location of the repository.
Have you had problems using this url!?

@ghost
Copy link
Author

ghost commented May 8, 2018

@daviian
Copy link
Member

daviian commented May 8, 2018

I think this could be related to this one: #3848. Especially this comment #3848 (comment)

Please try:

  • Rewrite '.ssh/authorized_keys' file (for Gitea SSH keys). There is no need to do this if you are using the built-in SSH server.
  • Resync pre-receive, update and post-receive hooks of all repositories.

from Admin Panel

EDIT 1: Another possibility is that you are missing permission to access that repository.
Maybe your public key, you've entered in your user settings, is missing / wrong.

EDIT 2: Maybe your git users lacks a login shell?

@ghost
Copy link
Author

ghost commented May 8, 2018

pre-receive and update seem to be populated with the default content, if I'm not mistaken (/user/repo/settings/hooks/git)

@ghost
Copy link
Author

ghost commented May 8, 2018

Did not see your edits.

  • can use ssh://git@domain:port/home/git/user/repo.git without problems, so permissions are there
  • I've rerun your points. Nothing changed.
  • The git user has a login shell and it's working.
  • I'm not using ssh keys at this point. But just for the sake of testing I did setup everything to use ssh keys, still no change.

@daviian
Copy link
Member

daviian commented May 8, 2018

@youwontguess Can you provide the log entries during repository cloning?

@ghost
Copy link
Author

ghost commented May 8, 2018

Thank you @daviian , that was the right hint.

May 8 19:22:59 Ubuntu-1704-zesty-64-minimal sshd[2390]: Authentication refused: bad ownership or modes for directory /home/git/.ssh

Fixed that, now auth via ssh keys is working :)

@daviian
Copy link
Member

daviian commented May 8, 2018

You are welcome!

@ghost ghost closed this as completed May 8, 2018
@kiemrong08
Copy link

I faced same problem, anyone else have a solution.
Git version 280ebcb.
OS: CentOS 7.3
DB: MySQL
Can you reproduce the bug at https://try.gitea.io: No

$ git clone [email protected]:david/c-learning.git
Cloning into 'c-learning'...
fatal: 'david/c-learning.git' does not appear to be a git repository
fatal: Could not read from remote repository.

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

@sky5454
Copy link

sky5454 commented Aug 7, 2019

YES, and more than this. When didn't use port 80(I use port 3000) , the SSH clone link is wrong. The copled link is git@localhost:Exam/Repos.git, but actually it must be ssh://git@hostname:port/Exam/Repos.git


And http clone is ok. (My Repos is private, http clone works.)

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants