You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Our company git repository is hosted as a plain collection of git directories in the home dir of the hosting user git. That is when I clone git@gitserver:a/b I am actually cloning from gitserver:/home/git/a/b. The standard git client supports this setup without any further client side configuration.
Trying to clone the same repository with go-git results in a repository not found error. Adding the server-side base path to the repository on the client side, that is cloning git@gitserver:home/git/a/b solves the issue, but this behaviour is different from the standard client!
The error does not occur when a daemon is run with a correct value for base-path (such as in public services like github), but the general problem is that the path passed to the server is absolute, that is, it starts with a slash. Dropping the slash prefix in place where the URL is parsed keeps the support for github and Co, but also enables it for this most basic setup.
Here is what happens step by step:
The transport.NewEndpoint function first converts git@gitserver:a/b into ssh://git@gitserver/a/b, then it calls the url.Parse method, which, in turn, returns the URL structure with the Path already set to /a/b. Then the client is created and it sends this absolute path to the server. Dropping the leading slash between parsing the original URL and returning the endpoint solves the issue, but seems ugly.
The text was updated successfully, but these errors were encountered:
Our company git repository is hosted as a plain collection of git directories in the home dir of the hosting user
git
. That is when I clonegit@gitserver:a/b
I am actually cloning fromgitserver:/home/git/a/b
. The standard git client supports this setup without any further client side configuration.Trying to clone the same repository with
go-git
results in arepository not found
error. Adding the server-side base path to the repository on the client side, that is cloninggit@gitserver:home/git/a/b
solves the issue, but this behaviour is different from the standard client!The error does not occur when a daemon is run with a correct value for
base-path
(such as in public services like github), but the general problem is that the path passed to the server is absolute, that is, it starts with a slash. Dropping the slash prefix in place where the URL is parsed keeps the support for github and Co, but also enables it for this most basic setup.Here is what happens step by step:
The
transport.NewEndpoint
function first convertsgit@gitserver:a/b
intossh://git@gitserver/a/b
, then it calls theurl.Parse
method, which, in turn, returns theURL
structure with thePath
already set to/a/b
. Then the client is created and it sends this absolute path to the server. Dropping the leading slash between parsing the original URL and returning the endpoint solves the issue, but seems ugly.The text was updated successfully, but these errors were encountered: