我正在尝试使用git服务器码头映像来设置本地git服务器。
我的停靠-撰写配置如下:
git-server:
image: jkarlos/git-server-docker
restart: always
ports:
- "22:22"
volumes:
- ./docker/git-server/keys:/git-server/keys
- ./docker/git-server/repos:/git-server/repos
使用此设置,以下两个版本中的第一个版本可以工作,而第二个版本则不能工作。
git clone ssh://git@localhost/git-server/repos/my_repo.git
git clone git@localhost:git-server/repos/my_repo.git
第二个版本提供了以下错误消息:
Cloning into 'my_repo'...
fatal: 'git-server/repos/my_repo.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我原以为这两个版本是一样的,但这显然是错误的。有什么关系?
发布于 2022-11-27 19:28:24
第一种有效,而第二种则无效。 git克隆ssh://git@localhost/git-server/repos/my_repo.git
是的,它访问了绝对路径/git-server/repos/my_repo.git
。
git克隆git@localhost:git-server/repos/my_repo.git
它尝试并访问相对路径git-server/repos/my_repo.git
使用绝对路径应该更好:
git克隆git@localhost:/git-server/repos/my_repo.git
^^^^
或者,如果存储库不在/git-server
,而是,/another/path/to/git-server/...
git克隆git@localhost:/another/path/to/git-server/repos/my_repo.git ^#完整的完整路径
https://stackoverflow.com/questions/74590958
复制相似问题