[SOLVED] Cannot Import an Existing Repository from Linux Into a GitLab Project

I’m new to git & even newer to gitlab, so maybe my entire approach is wrong. I created several empty projects in GitLab. Because most projects will have multiple developers, I created a group for each project & put under the group. Then I went to an existing git (not gitlab) repository via the Linux command line. (Actually, I copied an existing repository so I wouldn’t mangle the one in use) I followed the instructions GitLab gives for importing an existing repository. I cd’ed to that repository, then:

git init

# g_rishum-net is the group, and rishum-net_2017 is the project
git remote add gitlab git@myserver.com:g_rishum-net/rishum-net_2017.git
git add .
git commit

The above works. But the push doesn’t. Since I’m not using any of SSH’s standard keys (e.g., ~/.ssh/id_rsa), I do the following:

GIT_SSH_COMMAND='ssh -v -i /home/haimrom/.ssh/gitlab_batch_user'
git push -u --verbose  gitlab master

But that last command keeps asking for user git’s password.

Note that when I simply SSH to git@myserver.com using the key, SSH accepts the key (the problem is from the fact that such a login is restricted to gitlab-shell):

ssh -i ~/.ssh/gitlab_batch_user  git@myserver.com  git-shell  help
GitLab: Disallowed command

How can I use that SSH key? Or should I be trying HTTPS instead?

I still don’t know why using GIT_SSH_COMMAND didn’t work. But I ended up using ~/.ssh/config instead, and that did work. It’s contents are:

Host  myserver.com
    IdentityFile    ~/.ssh/gitlab_batch_user
    IdentitiesOnly  yes