将 gitosis git 存储库与 XCode 4 结合使用

发布于 2024-10-31 18:07:41 字数 754 浏览 1 评论 0原文

你好 我一直在尝试从 XCode 4 访问我的 git 存储库。

使用命令行工具一切正常。我可以使用以下方式克隆我的存储库:

git clone [email protected]:somerepo.git

但是在 XCode 中,当尝试使用:

ssh://[email protected]:somerepo.git

它只是不断要求我输入密码,而我根本不想使用该密码。

同样的事情发生在:

git://[email protected]:somerepo.git

除了我还收到“连接被拒绝:无法连接到套接字”错误消息。

知道如何解决这个问题吗?

Hi
I've been trying to access my git repository from XCode 4.

Everything works just fine using the command line tools. I can clone my repo using:

git clone [email protected]:somerepo.git

But in XCode, when trying to use:

ssh://[email protected]:somerepo.git

It just keeps asking me for a password, which I don't want to use at all.

The same thing happens with:

git://[email protected]:somerepo.git

Except that i also get a "Connection refused: unable to connect to a socket" error message.

Any idea how to solve this?

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

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

发布评论

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

评论(7

鲜血染红嫁衣 2024-11-07 18:07:42

至少对于 Xcode 4.2,您不需要指定协议。只需使用

[email protected]:somerepo.git

因为我发现这个线程有类似的症状但有不同的问题,所以我会补充说我忘记为新用户添加 gitosis 的密钥,所以我遇到了我认为与 Xcode 相关但实际上是一个问题gitosis配置问题。

At least for Xcode 4.2, you don't need to specify a protocol. Just use

[email protected]:somerepo.git

Since I found this thread with a similar symptom but a different problem, I'll add that I had forgotten to add a key to gitosis for a new user so I was getting problems that I was thinking were Xcode related but were actually a gitosis configuration problem.

墨落画卷 2024-11-07 18:07:42

您应该确保您没有启用任何 proxy ,因为它有时会导致 xcode 中无法访问目标。

一旦你填写了存储库名称,你必须检查存储库的“类型”是否是git,而不是SVN,因为我发现xcode可以更改类型。

最后您应该成功访问存储库。

YOU should make sure you didn't enable any proxy , because it would cause the target unreachable in xcode sometimes.

Once you fill in the repository name, you must check if the repository "type" is git, not SVN, because I found xcode can change the type.

Finally you should be successful to access the repo.

眼泪都笑了 2024-11-07 18:07:42

我有自己的 GIT 服务器,使用 GIT-SCM。

我尝试了 URL ssh://[电子邮件受保护]: 22/gitname.git 并将私钥放入 ~/.ssh/user

CHMOD 为 0600

当我连接时,它要求我输入用户名和密码,但没有密码

I have my own GIT server using GIT-SCM.

I tried the URL ssh://[email protected]:22/gitname.git and put the private keys in ~/.ssh/user

CHMOD to 0600

And when I connect it asks me for a username and password, but there is no password

你列表最软的妹 2024-11-07 18:07:42

通过 git 协议 克隆 Git 存储库(这是您在命令中所做的行)与使用 ssh+git 协议(其中是您在 XCode4 中首先尝试的方法)

如果在您的 $HOME/.ssh 目录中找不到公钥,则只有 ssh 会要求输入密码。
如果您有权访问服务器 example.com 上的端口 9418,则不需要 ssh 进行克隆(如果 example.com 上设置了身份验证层,您可能需要它 服务器)

“无法连接套接字”错误是典型的防火墙/代理问题:请参阅 Gi​​t 错误:致命:无法连接套接字(参数无效)

检查您的 git config -l : XCode 4 可能不使用与 git 在命令行中使用的完全相同的设置。

Cloning a Git repo through the git protocol (which is what you did in command line) isn't the same than using a ssh+git protocol (which is what you tried first in XCode4)

Only ssh would ask for a password, if no public key is found in your $HOME/.ssh directory.
And if you have access to port 9418 on the server example.com, you don't need ssh to clone (you might need it if there are an authentication layer set on the example.com server though)

The "unable to connect a socke" error is typical of a firewall/proxy issue: see Git error: fatal: unable to connect a socket (Invalid argument).

Check your git config -l: it is possible XCode 4 don't use the exact same setting that your git used in command line.

远昼 2024-11-07 18:07:41

在 Xcode 4.2 中,以下位置字符串对我有用。

ssh://[email protected]:22/somerepo.git

ssh:// 部分需要告诉 Xcode 应使用哪个协议。由于 URL 现在包含一个方案,因此还需要端口 :22 说明符才能使 Git 满意。 没有端口,我在命令行上收到以下(奇怪的)错误消息:“ssh:连接到主机端口 22:连接被拒绝”。

顺便说一下:当我在 Organizer 窗口中添加我的存储库时,Xcode 咕哝了一些关于“需要身份验证”的内容,然后开始旋转活动指示器。虽然我能够立即克隆存储库,但我必须重新启动 Xcode 才能摆脱活动指示器。

In Xcode 4.2, the following location string worked for me

ssh://[email protected]:22/somerepo.git

The ssh:// part is required to tell Xcode which protocol should be used. Since the URL now contains a scheme, the port :22 specifier is also required to make Git happy. Without the port, I got the following (weird) error message on the command line: "ssh: connect to host port 22: Connection refused".

By the way: When I added my repository in the Organizer window, Xcode mumbled something about "authentication is needed", then started to spin an activity indicator. Although I was able to clone the repo immediately, I had to restart Xcode to get rid of the activity indicator.

無心 2024-11-07 18:07:41

我发现使用 ssh://[email protected]/myrepo 有效。请注意,“git”是我用于 gitolite 的用户名(完全按照其网站上的说明,正确添加用户的公钥),git.mydomain.com 是安装 gitolite 的主机名,“myrepo”是存储库的名称(对我来说,它无需在末尾添加“.git”即可工作)。

另一部分是确保您的 OpenSSH 密钥位于 ~/.ssh/id_rsa (私有;将其 chmod 为 0600,否则它将不起作用)和 ~/.ssh/id_rsa.pub (公共;我不知道这是否是需要的,但我从来没有费心去检查)。

上面的方法一直有效,没有“副作用”,至少对我来说......

I found that using ssh://[email protected]/myrepo worked. Note that "git" is the username I used for gitolite (following the instructions on their website exactly, properly adding the public key for the users), git.mydomain.com is the hostname of where gitolite was installed, and "myrepo" is the name of the repository (it works without adding ".git" at the end for me).

The other part is making sure that your OpenSSH keys are in ~/.ssh/id_rsa (private; chmod it to 0600 or it will not work) and ~/.ssh/id_rsa.pub (public; I don't know if this is needed but I never bothered to check).

The above works all the time, with no "side effects," at least for me...

神回复 2024-11-07 18:07:41

XCode 4 在 ~/.ssh 目录中查找密钥对,

您需要将公钥添加到远程存储库中的用户

,然后 XCode 可以克隆存储库

XCode 4 look for a key pair in the ~/.ssh directory

you need to add the public key to your user in the remote repository

then XCode can clone the repository

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