I am trying to push content from a workstation to a server. But it gives me an error. Please look at the following for command and error:
Administrator@ganes
As illustrated in the doc ssh troubleshooting, this is probably caused by an incorrect path during cloning.
The documentation (some parts below were only valid for Gitolite V2) mentions:
The second error
(ie. "you are able to clone repositories but are unable to push changes back (the error complains about the GL_RC
environment variable not being set, and the hooks/update failing in some way)
happens if you use
git@server:repositories/reponame.git
(assuming defaultsetting -- in Gitolite V3, it always is$REPO_BASE
~/repositories
) -- that is, you used the full unix path.
Since the "prefixing" mentioned above is not required, the shell finds the repo and clones ok.
But when you push, gitolite's update hook kicks in, and fails to run because some of the environment variables it is expecting are not present.
The message that appears on a successful run of the "easy-install" program clearly includes the following warning:
*Your* URL for cloning any repo on this server will be
gitolite:reponame.git
*Other* users you set up will have to use
<user>@<server>:reponame.git
However, if your server uses a non-standard ssh port, they should use
ssh://<user>@<server>:<port>/reponame.git
So in your case, you must have cloned your repo with:
git clone git@ganesh:repositories/testing.git
instead of:
git@ganesh:testing.git
Just got the same error.
Correct answer is you need to use git clone gitolite:repo_name
command to clone the repository and git push gitolite:repo_name
to push changes, instead of git clone git@yourservername:repo_name
.
The ssh troubleshooting document at http://sitaramc.github.com/gitolite/doc/ssh-troubleshooting.html (as well as in the gitolite source repo) has been totally re-worked now. I'm hoping that it flows much better and explains things easier, including this specific error.
I'll also add that you should ideally read that document in full, at least the first time.
Sitaram
Try to:
ssh git@ganesh
You should see gitolite-shell instead of bash:
ssh git@localhost
PTY allocation request failed on channel 0 hello
id_rsa, the gitolite version here is 2.0.3-2 (Debian) the gitolite
config gives you the following access:
R W gitolite-admin
@R_ @W_ testing
Connection to localhost closed.
If not it means you bypass gitolite-shell and use bash instead. The reason might be, that by running gl-setup your_pub_key.pub you added your key to the bottom of /home/git/.ssh/authorized_keys file.
Therefore, this key is never reached, because there are other keys at the top. So, you simply need to open /home/git/.ssh/authorired_keys and move the recently added gitolite key to the top of the file.
After moving this record to the top of the file, you should be able to use: git clone git@ganesh:testing.git insead of git clone git@ganesh:repositories/testing.git The second one clones the repo but leads to the error, because you run "git push" via bash instead of gitolite-shell