I have a host and a server machines with established SSH connection between them. On the server I have a fresh created git repository.
I want to clone this repository from server to a host via SSH connection. As far as I understand, I should use next command:
git clone <USER>@<SERVER>:<REMOTE GIT ROOT DIRECOTRY>/<REPOSITORY>.git
Here is a questions:
Where from I get a <REPOSITORY>
name?
CodePudding user response:
When you create a git repository, you create it in some directory. The name of that directory becomes, for all intents and purposes, the name of that repository (minus the '.git' part, typically).
Unless there's some special configuration on the server, the part after :
in git clone
is simply the path to your repository on the server. Leading slash (e.g. /srv/git/foo.git
) means absolute path. Otherwise (e.g. git/foo.git
), it's a path relative to <USER>
's home directory.
So, if, on the server, you have a directory /srv/git/foo.git
, and inside you intialise a bare git repostitory (git init --bare
), your clone command will look like:
git clone <USER>@<SERVER>:/srv/git/foo.git