How to insert SSH key on a Git server (git-shell access only)

I'd like to add my SSH key to authorized keys on a git server (a company server), to not have to insert my password every time I push. However for some reason I cannot make that working.

What I tried:

ssh-copy-id user@server
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
user@server's password: 
fatal: unrecognized command '
        umask 077 ;
        mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ;
        if type restorecon >/dev/null 2>&1 ; then restorecon -F .ssh .ssh/authorized_keys ; fi'

When I try to ssh to the git server, I get the following response:

fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.

Apparently the user account is using git-shell and it seems that it does not understand the usual shell commands.

Is it still possible to add the public SSH key to the git server user account somehow? Is there perhaps some git command which would allow me to put my public SSH key to the list?

The only access I have to the git server is via the command line and there is the GitWeb interface running (but in there I do not see any option to install the SSH key either).


you should contact your sysadmin, make sure user home dir permisson without write permission for others.

and for /home/user/.ssh permission advice to be its group and ownwer itself with 0700, and the /home/user/authorized_keys permission 0600.

I assume that user group is git.

# cd /home/user
# chown -R user:git  .ssh
# chmod 0700 .ssh
# chmod 0600 .ssh/authorized_keys

If this file(.ssh/authorized_keys), the ~/.ssh directory, or the user's home directory are writable by other users, then the file could be modified or replaced by unauthorized users. In this case, sshd will not allow it to be used unless the StrictModes option has been set to “no”.

More infomation just see man 8 sshd

Need Your Help

Merging two variable names together in javascript

javascript google-maps

I'm trying to make a loop in which I create multiple markers for Google Maps. I want these markers to be named marker+int. I can't merge 2 variable names as I found out, so I need another way to do...

JSON Data cannot be matched to web service signature jquery json service

I still can’t seem to get this to work.I’ve tried string arrays object arrays dictionaries. I might be formatting my JSON incorrectly however I am using the labs_JSON plugin. If I remove my data an...