I am trying to work with
Git and am having some problems. The scheme is as follows:
I have two PCs in my house, one I want it as a server, to host my projects and the other I want it to clone those projects. The problem arises when cloning. The two PCs have Linux and created the
git users and their emails.
The PC that acts as a server has a repository created in the following path:
And from the client PC I want to clone it. I have read that there are various access methods like
I have generated the
ssh keys from client and server, and my client's public
ssh key has already been added to my server's
What am I doing wrong that I can't clone it?
I have tried the following commands:
git clone git@ip_local_servidor/usuario_servidor/ruta_del_repo/repositorio.git
git clone git@ip_pública_servidor/usuario_servidor/ruta_del_repo/repositorio.git
git clone ssh://usuario_servidor@ip_pública_servidor/ruta_del_repo/repositorio.git
git clone http://ip_pública_servidor/usuario_servidor/ruta_del_repo/repositorio.git
The last one (number 5) I'm not really sure, I just copied it from the internet and edited the user and the path, but the
clone+ssh header I don't know if it is left like this or refers to something else.
I would appreciate if you can help me and answer, I have been trying this for weeks and I can not achieve it. From already thank you very much.
PS: I have tried different
IPs , the local one that is given by my router, and the public one when I connect to the internet. Example 1 and 2 are the same, they just have different
I think the path you are using to access your repository is not correct. The command you should use would be this:
git clone user@ip_servidor:/var/www/html/carpeta_del_proyecto/repositorio.git
Also, you could have a permission problem, to make sure you could use the
scp command and check if that user has read and write permissions on that folder and if
ssh access is working for you. If you are going to have a single user, locating the repository in the user folder could simplify this.
Take a look at this link where you have documented how to create a Git server
You could also set up a more advanced server using the Community edition of GitLab , but that depends on your needs.