Sign up ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I know I can log in to github and edit code directly on the site, without cloning the repository.

Is there a way to do something similar via ssh, so that I can edit files using just a console?

Please assume I cannot just clone the code onto my own server.

share|improve this question

migrated from Nov 22 '11 at 19:49

This question came from our site for computer enthusiasts and power users.

2 Answers 2

up vote 5 down vote accepted

Git relies on the fact that SSH allows you to execute commands on a remote server.

If you run a command like git clone, what Git is doing behind the scenes is SSHing to, authenticating as the tom user, and then remotely executing git upload-pack username/repo. Now your client can talk to that process on the remote server by simply reading and writing over the SSH connection.

Of course, allowing arbitrary execution of commands is unsafe, so SSH includes the ability to restrict what commands can be executed. In a very simple case, you can restrict execution to git-shell which is included with Git. All this script does is check the command that you’re trying to execute and ensure that it’s one of git upload-pack, git receive-pack, or git upload-archive.

So the syntax is:

ssh git@<route> <command> <arg>

For instance:

$ ssh "git-upload-pack username/repo.git"
$ ssh "git-receive-pack username/repo.git"

So to answer to your question, you can't edit the code over ssh, but you can upload your changes if you know the right syntax.


If you would like to trace which commands are sent to the git server, follow your git command by GIT_TRACE=1 i.e.:

GIT_TRACE=1 git clone

Or for the hardcode mode, use strace like:

strace -f -s200 -e execve git clone


See also the following articles:

share|improve this answer

No, GitHub does not provide interactive SSH access.

$ ssh
PTY allocation request failed on channel 0
Hi grawity! You've successfully authenticated, but GitHub does not provide shell access.
Connection to closed.
share|improve this answer
Is there a reference link? –  phwd Nov 23 '11 at 17:34
@phwd: Couldn't find any, but that's what the server itself tells you. ssh –  grawity Nov 23 '11 at 18:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.