git clone through ssh

I have a project on which I created a git repository:

$ cd myproject  
$ git init  
$ git add .  
$ git commit  

I the wanted to create a bare clone on another machine:

$ cd ..  
$ git clone --bare myproject  ssh://user@server:/GitRepos/myproject.git  

I executed the clone but did not print any answer. I logged on to the server machine and tried to see how the files are stored. The path /GitRepos was empty, so I decided to do the clone again:

$ git clone --bare myproject  ssh://user@server:/GitRepos/myproject.git

This time the answer was :

fatal: destination path 'ssh://user@server:/GitRepos/myproject.git' already exists and is not an empty directory.

But I saw that the path was empty.
What's going on here ?

208
задан BartoszKP 8 September 2015 в 13:06
поделиться

1 ответ

попробуйте это.

Шаг 1:

ls -al ~/.ssh

enter image description here

Шаг 2:

ssh-keygen 

(использующий клавишу Enter для значения по умолчанию) enter image description here Шаг 3: устанавливать файл конфигурации

vim /c/Users/Willie/.ssh/config

Хост gitlab.com
Пользовательский мерзавец HostName gitlab.com

шаг 4 IdentityFile ~/.ssh/id_rsa

:

git clone git@gitlab.com:<username>/test2.git

enter image description here

Шаг 5:
то, Когда Вы закончили файл Шага 4
1.the test2.git, будет загрузкой, сделанной
2.you, получит новый файл (known_hosts) в ~/.ssh
enter image description here

пз: Я создаю id_rsa и id_rsa.ub meself, и я поставляю его серверу Gitlab. использование обоих ключей к любым сторонам клиента (окна и Linux).

0
ответ дан 23 November 2019 в 04:41
поделиться
Другие вопросы по тегам:

Похожие вопросы: