I installed gitolite on my server using this tutorial. This falls under the "non-root" method.
It fails when I try to clone gitolite-admin back to my client. I get this error message:
git clone [email protected]:gitolite-admin
Cloning into gitolite-admin...
fatal: The remote end hung up unexpectedly
Also:
git clone ssh://[email protected]:gitolite-admin
Cloning into gitolite0admin...
Using username "git-upload-pack 'gitolite".
fatal: The remote end hung up unexpectedly
I have also tried appending .git
to the end of the repo name, and I have also tried adding repositories/gitolite-admin
(suggested by the errors in the tutorial linked above) and a combination of both of these and none work. I can find no results on google regarding the "Using username" bit, which intrigues me.
I can connect to the machine via ssh, and it tells me that I have access to R and W gitolite-admin
. So, SSH is working?
Gitolite and ssh explains how gitolite uses openssh features to create any number of virtual users over just one actual (unix) user, and distinguish between them by their public keys. Ssh troubleshooting is a rather long page that, as far as I know, covers almost every known ssh related issue.
If you're installing gitolite, you're a "system admin", like it or not. Since most people use the ssh mode, ssh is therefore a necessary skill. Please take the time to learn at least enough to get passwordless access working. You also need to be somewhat familiar with git itself.
Solved: Cloning over SSH Doesn't Work for a Remote Account... The Atlassian Community can help you and your team get more value out of Atlassian products and practices. I hope that subject line isn't confusing. :) I am using Sourcetree and am pretty familiar with Git having used it via Bash for several years now.
Install gitolite on the new server, using the same key for the admin as for the old server. Copy the rc file from the old server, overwriting this one. Disable the old server so people won't push to it. Copy all the repos over from the old server. Make sure the files end up with the right ownership and permissions; if not, chown/chmod them.
Check the ssh parts about gitolite: the fact that you can connect to server.com
through ssh
only means:
server.com@~/.ssh/authorized_keys
command=
" option, which means "regardless of what the incoming user is asking to do, forcibly run this command instead").What I don't like at all about the third-party tutorial is that it tries using the same name for git user and ssh non-root user
You should keep separate:
gitolite-admin
repo)git
', not gitolite
, precisely to avoid confusion between the two usage mode:
git
(log on directly on server.com
, no ssh here): interactive session needed to execute git command (like cloning on the server the gitolite repo, and executing gitolite/src/gl-system-install
)ssh [email protected]
which will use your ~/.ssh/id_rsa(.pub)
public and private keys, which, being the ones of the gitolite, will authorize you to clone the gitolite-admin
repo and push back that repoAgain:
'gitolite' is not a true account, only a name authorized to execute commands on server.com
as 'git
' (the actual "hosting account", as in "hosting git services and repos").
All the other git users will also execute git commands on server.com
as git
.
And that particular user (gitolite
) will be linked to gitolite authorization layer through the forced-command mechanism, with privileges setup during the gitolite installation in order to grant that 'user' rights to clone, modify and push back gitolite-admin
repo.
(That is its only particularity compared to all the other ssh git users you will add: they won't have access to that specific git repo which is the gitolite-admin
one)
Trying to name the two with the same name is just asking for trouble.
I don't like using the default naming convention for the public/private keys, so I prefer on the client defining those keys with the name of the intended user:
~/.ssh/gitolite.pub
~/.ssh/gitolite
Then I define a config file: ~/.ssh/config
with in it:
host gitolite
user git
hostname server.com
identityfile ~/.ssh/gitolite
(Note the user here: always git
)
Then I can clone my gitolite-amin
repo:
git clone gitolite:gitolite-admin
# modify locally
# git add -A ; git commit -m "my modifs"
git push origin master
For posterity, the fix is to make sure that GIT_SSH is not set to TortoisePlink.exe. Git can't use it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With