[英]GitLab setting up an ssh key
在將 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"
然后按照此處描述的步驟生成並添加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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.