2

I am building a git server on Ubuntu.

On the git server, I create a git repository on /opt/var/git/example.git. When a client wants to clone this git repository, he should use the command "git clone ssh://username@host-ip/opt/var/git/example.git"

I wonder if there is any way to short the ssh path and hide the absolute path.

For example, the client could clone "example.git" by "git clone ssh://username@host-ip/example.git".

Thanks!

4

2 回答 2

0

另一种选择是添加一个授权层,比如gitolite,它:

  • 将控制谁可以克隆什么
  • 始终为 git 存储库使用短地址

    git clone git@host:arepo

(不需要.gitat then 结束)

于 2012-10-22T10:53:59.953 回答
0

您只需将用户的主目录设置为 git 存储库所在的位置。

或者您可以将 repo 符号链接到用户主目录中ln -s /path/to/repo ~/reponame.git

于 2012-10-22T09:10:38.537 回答