Frage

I'm attempting to run my own git server with gitweb as the web interface. I'm serving up a directory called 'git/' here: /Users/me/Sites/git, which is the document root for git.example.com

I've created a user on my mac named 'git', such that I can ssh git@git.example.com, and I am logged in ok.

Now, say I'm working as 'me@example.com' (the user), and I want to push to my remote @ git.example.com, I have to type in git remote add gitweb ssh://git@git.example.com/~/Sites/git/projectname.git

Is there any way I can remove the ~/Sites/git/ from the url? Ideally, I want to be able to type: git remote add gitweb ssh://git@git.example.com/projectname.git

War es hilfreich?

Lösung

GitWeb and ssh is for two different Git access mechanism:

  • Gitweb would be served by an Apache http server: see my httpd.conf as an example. But it isn't for cloning, only for browsing.
  • an http(s) access would require this config, with an alias calling the git-http-backend (in my example, I call gitolite-shell because I want to benefit from the authorization layer which is Gitolite)
  • an ssh access is through the ssh daemon (no need for a git daemon here, plus the git protocol cannot be used for pushing), and will necessitate the full path.

The only case where ssh doesn't need the full path to execute your clone/push/pull command is when it is using the ssh forced command mechanism in order to intercept your git command and call a custom script (which can transform your "projectname.git" into a "~/Sites/git/projectname.git").
That is what Gitolite does, for instance.

Andere Tipps

you can leverage git deamon 's --base-path, e.g. I share a git repo1 under /home/fengxx/gitdemo/ in 192.168.52.2

git daemon --verbose --export-all --base-path=/home/fengxx/gitdemo/

and in another pc, I can run

git clone git://192.168.52.2/repo1

if I have to use ssh the URL will be ~/gitdemo/repo1

git clone ssh://fengxx@192.168.52.2/~/gitdemo/repo1

And you can set user.name by

git config --global user.name yourlogin
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top