[英]GitLab setting up an ssh key
I clone an empty project directory from a project I'm part of, after configuring git global as:在将 git 全局配置为之后,我从我参与的项目中克隆了一个空项目目录:
$ 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"
Then a follow the steps described here to generate and add an ssh key
(I actually created an ED25519 SSH keys
).然后按照此处描述的步骤生成并添加
ssh key
(我实际上创建了ED25519 SSH keys
)。 But testing to ensure the ssh was correctly added failed.但是确保正确添加 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
Content of my ssh key directory:我的 ssh 密钥目录的内容:
$ ls /home/user/.ssh/
id_ed25519 id_ed25519.pub id_rsa id_rsa.pub known_hosts known_hosts.old
How do I fix this?我该如何解决?
EDIT编辑
I did a ssh -T git@gitlab.com
as suggested in the comment, a welcome message displayed, but this doesn't seem to work, I cannot git push
to the remote.我按照评论中的建议做了一个
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.