gitolite-admin clone issue

2019-04-30 02:19发布

问题:

I am going nuts with a problem cloning the gitolite-admin repository. I have followed this http://sitaramc.github.com/gitolite/install.html#migr and it went perfectly.

I ran ssh-keygen -t rsa and scp ~/.ssh/id_rsa.pub morten@ubuntu-server:/tmp/morten.pub

authorized_keys on the server looks like this:

# gitolite start
command="/home/morten/gitolite/src/gitolite-shell morten",no-port-forwarding,no-X11-forwarding,no-agent-forward$
# gitolite end

Which AFAIK is okay.

When I run git clone morten@ubuntu-server:gitolite-admin on my client, I get

fatal: 'gitolite-admin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I have no idea what I missed!

回答1:

Using morten account is perfectly fine.

However, your installation is strange, considering your current ~morten/.ssh/authorized_keys content:

Instead of /home/morten/gitolite/src/gitolite-shell morten|, you should have /home/morten/gitolite/bin/gitolite-shell morten

That means: gitolite-shell should be in your $PATH, and it should be in a bin directory, created after executing:

"${github}/install" -to "${gtl}/bin"

(See option 3 of the "actual install" section of "Installing Gitolite")

with:

  • github the path where you have cloned https://github.com/sitaramc/gitolite
  • gtl the path where you want to install gitolite (in your case, for instance, /home/morten/gitolite)

Then, it is easier to save your authorized_keys and .gitolite.rc file, and re-do the initialization process:

gitolite setup -pk "${HOME}/.ssh/gitoliteadm.pub"

(provided you created your public and private key, naming it 'gitoliteadm', with a simple:

ssh-keygen -t rsa -f "${H}/.ssh/morten" -C "Gitolite Admin access (not interactive)" -q -P ""

)

Note that I keep the 'ssh' account name (morten) different than the gitolite server account (gitoliteadm) on purpose.

You will still clone with git clone morten@ubuntu-server:gitolite-admin (because all ssh files are in ~morten/.ssh), but you will do so with the private/public key of gitoliteadm, prompting gitolite to access its repo with a gitolite "account" named "gitoliteadm".

That way, if you change physical user account for your gitolite server, the "logical" account 'gitoliteadm' (referring to a role, not to a person or resource).