GitLab настраивает ключ ssh - PullRequest
       16

GitLab настраивает ключ ssh

0 голосов
/ 05 ноября 2019

Я клонирую пустой каталог проекта из проекта, частью которого я являюсь, после настройки git global как:

$ git config --global user.name "My Username"
$ git config --global user.email "myeamil.com"

$ git clone git@gitlab.com:our-projects/this-project.git
$ cd this-project
$ touch README.md
$ git add README.md
$ git commit -m "add README"

Затем выполните шаги, описанные здесь , чтобы сгенерировать и добавитьssh key (на самом деле я создал ED25519 SSH keys). Но проверка, чтобы убедиться, что ssh был правильно добавлен, не удалась.

$ ssh -T git@our-projects/this-project.git
ssh: Could not resolve hostname gitlab.com:it-porto/transportation-mode-detection.git: Name or service not known

$ ssh -T git@our-projects
ssh: Could not resolve hostname gitlab.com:it-porto/transportation-mode-detection.git: Name or service not known

$ ssh -T git@this-project.git
ssh: Could not resolve hostname gitlab.com:it-porto/transportation-mode-detection.git: Name or service not known

Содержимое моего каталога ключей ssh:

$ ls /home/user/.ssh/
id_ed25519  id_ed25519.pub  id_rsa  id_rsa.pub  known_hosts  known_hosts.old

Как это исправить?

РЕДАКТИРОВАТЬ

Я сделал ssh -T git@gitlab.com, как предложено в комментарии, отобразилось приветственное сообщение, но, похоже, это не сработало, я не могу git push на пульте.

$ssh -T git@gitlab.com
Welcome to GitLab, @user!

$git push origin master
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 45.49 KiB | 3.50 MiB/s, done.
Total 8 (delta 0), reused 0 (delta 0)
remote: GitLab: 
remote: A default branch (e.g. master) does not yet exist for our-projects/this-project
remote: Ask a project Owner or Maintainer to create a default branch:
remote: 
remote:   https://gitlab.com/our-projects/this-project/-/project_members
remote: 
To gitlab.com:our-project/tthis-project.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@gitlab.com:our-projects/this-project.git'


$ git remote -v
origin  git@gitlab.com:our-projects/this-projectt.git (fetch)
origin  git@gitlab.com:our-projects/this-projectt.git (push)

1 Ответ

0 голосов
/ 05 ноября 2019

Вы готовы пойти

Read the content of file by  cat id_rsa.pub 

И скопировать содержимое из терминала, откройте ваш интерфейс gitlab в верхнем левом углу, нажмите на пользователя и затем установите.

Перейти к SSH и вставьте свой вышесодержимое в коробке enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...