2

After creating a new repo (local + remote), I am trying to push commits. However I get an issue with the SSH key

In my ~/.ssh/config , I have an entry for gitlab defined as

Host MyRepoJD
HostName gitlab.myrepo.ninja
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab_myRepo/johnDoe

when I try to push from my ruby script, to the newly created repo in gitlab ( gran_torino_sa/mar_arch group: gran_torino_sa project: mar_arch) it's failing as there is no entry for this newly created repo...

ssh: Could not resolve hostname    
gitlab.myrepo.ninja:gran_torino_sa/mar_arch.git: nodename nor servname provided, or not known

Is there a way to define only ONE entry for any group/project created or is it mandatory to add an entry for each new group/project?

1 Answer 1

1

myrepoafter debugging again ... found the solution in this post

"Specify an SSH key for git push for a given domain" Specify an SSH key for git push for a given domain

Host gitlab_as_johndoe
  HostName gitlab.myrepo.ninja
  User git
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/gitlab_myrepo/johndoe
  IdentitiesOnly yes

and using

  git remote add origin git@gitlab_as_johndoe:gran_torino_sa/mar_arch.git"

did the trick...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.