git 克隆权限被拒绝 (gitosis)

发布于 2024-12-10 00:35:57 字数 554 浏览 0 评论 0原文

我尝试在我的 linux-box (Debian) 上设置一个 git 存储库。我想在我的 osx Lion 上克隆 git 存储库。我安装了 gitosis,在我的计算机上创建一个 rsa 密钥 (git_rsa),将其放到服务器上,然后初始化 gitosis。 我有一个 ~/.ssh/config 文件,因为 ssh 端口不是默认端口。我也将 git_rsa 密钥添加到我的钥匙串中。 我的 ~/.ssh/config 看起来像

主机 git

HostName mydomain.com
Port 54321
Identityfile ~/.ssh/git_rsa
User git

当我尝试克隆管理存储库时,

git clone git:gitosis-admin.git

:我给出:权限被拒绝(公钥)。 fatal:远端意外挂断 问题是什么? (密钥被 chmoded 为 700,并且 ssh 可以完美地使用相同的密钥但另一个用户)

有人可以给我一个提示,我该如何解决这个问题?

提前致谢。

I try to setup a git repository on my linux-box (Debian). I want to clone the git repo on my osx Lion. I installed gitosis, create a rsa key my computer (git_rsa), put it to the server, and init gitosis.
I have a ~/.ssh/config file because the ssh port isn't the default. I added the git_rsa key to my keychain too.
My ~/.ssh/config looks like

Host git

HostName mydomain.com
Port 54321
Identityfile ~/.ssh/git_rsa
User git

when I try to clone the admin repo:

git clone git:gitosis-admin.git

I gave: Permission denied (publickey).
fatal: The remote end hung up unexpectedly
What is the problem? (The key is chmoded to 700 and ssh is work perfectly with the same key but another user)

Someone can give me a hint how can I resolve this problem?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你的心境我的脸 2024-12-17 00:35:57

好吧,我尝试了 gitolite,一切正常。方法如下:

  1. 使用 apt-get 安装 gitolite。
  2. 使用 gl-setup 命令添加密钥。
  3. 克隆 gitolite-admin.git 存储库。

不幸的是,我不知道吉特西斯出了什么问题。

Ok I tried gitolite and everything works fine. Here is the method:

  1. Install gitolite with apt-get.
  2. Add the key with gl-setup command.
  3. Clone the gitolite-admin.git repo.

Unfortunatelly I have no idea what was wrong with gitosis.

静待花开 2024-12-17 00:35:57

我在这个问题上遇到了麻烦。全新安装 gitosis 后,repo gitosis-admin.git 的克隆工作得很好。但是,在生成新的 RSA 密钥对并重新初始化后,

sudo -H -u git gitosis-init < id_rsa.pub

我也遇到了上述错误。

中的公钥后

id_rsa.pub

比较生成的公钥和我的 gitosis (git) 用户的主页

/home/git/.ssh/authorized_keys

,我注意到公钥不匹配。

id_rsa.pub 的内容替换 authorized_keys 中的密钥后,它就起作用了。

注意:由于authorized_keys文件是由gitosis自动生成和更新的,您还必须确保公钥文件(在我的例子中是id_rsa.pub)放置在keydir< /b> gitosis-admin 存储库的目录。

I was having trouble with this issue. After a fresh install of gitosis, the clone of repo gitosis-admin.git worked just fine. However, after generating a new RSA key pair, and re-initializing with

sudo -H -u git gitosis-init < id_rsa.pub

I also got the above error.

After comparing the public keys in the generated

id_rsa.pub

and the home of my user for gitosis (git)

/home/git/.ssh/authorized_keys

I noticed, that the public keys didn't match.

After replacing the key in authorized_keys with the content of id_rsa.pub it worked.

Note: Since the authorized_keys file is automatically generated and updated by gitosis, you will also have to make sure, the public key file (id_rsa.pub in my case) is placed in the keydir directory of the gitosis-admin repository.

桃气十足 2024-12-17 00:35:57

我们拥有自己的 gitosis 服务器并正在运行。

正确的命令应该是 -

git clone [server-git-user]@[domain-name.com]:repo.git

所以,

git clone [email protected]:gitosis-admin.git

假设您已经在服务器中创建了一个名为 git 的用户,并且在 gitosis.conf 中有如下内容

[group gitosis-admin]
members = key_file_name_in_keydir_folder_without_the_pub_extension
writable = gitosis-admin

We've our own gitosis server up and running.

The proper command should be-

git clone [server-git-user]@[domain-name.com]:repo.git

So,

git clone [email protected]:gitosis-admin.git

Assuming that you've created a user called git in your server and have something like following in your gitosis.conf

[group gitosis-admin]
members = key_file_name_in_keydir_folder_without_the_pub_extension
writable = gitosis-admin
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文