What Password to Use for 'Push to Create a Project'?

Viewed 28

I have an on-prem GitLab server hosted in docker.

I have a few local projects and I'm trying to push and create remote repos. I followed the GitLab documentations to 'push to create a project' (https://docs.gitlab.com/ee/gitlab-basics/create-project.html)

But when using git push --set-upstream git@mydomain.com:namespace/nonexistent-project.git master, I'm prompted to enter password for git@mydomain.com.

What password do I use here? I tried the admin password for GitLab server, password for my GitLab account and the passphrase for my SSH key, but none of them works.

1 Answers

If Git defaults back to a password, that means the SSH portion of the git push did not find a suitable SSH key.

That happens if your SSH key is not the standard default ~/.ssh/id_rsa, but a dedicated ~/.ssh/mykey.

In that case, you need a ~/.ssh/config file with:

Host mygitlab
  Hostname mydomain.com
  User git
  IdentityFile ~/.ssh/mykey

The push becomes:

git push --set-upstream mygitlab:namespace/nonexistent-project.git master

If your private key is passphrase-protected, don't forget to ssh-add it first.

Related