让 GIT 在 TakeCommand 中充分发挥作用

发布于 2024-11-07 14:54:52 字数 1125 浏览 0 评论 0原文

我正在尝试让 GIT 在我心爱的 Windows 7 上的 TakeCommand 命令行窗口 中充分工作。

我安装了 msysgit v。 1.7.3,创建了我的 SSH 密钥等,并且在 GIT Bash 中,一切都工作得很好。

但无论如何我总是打开 TakeCommand 窗口 - 所以我真的不希望只为 GIT 使用另一个命令行窗口。

大多数命令(例如 git status 、 git add 、 git commit 等)在 TakeCommand 中都可以正常工作 - 唯一不起作用的是拉和推。

我已经设置了一个指向我公司的中央存储库的 ~/.ssh/config 文件,并且在 Git Bash 中,一切正常。但在 TakeCommand 中,我得到:

D:\myGitProject> git pull "origin" master:master

ssh:gerrit:没有与名称关联的地址
fatal:远端意外挂断

WTF?!?!?与 git push 相同 - 这是怎么回事?我的 SSH 已设置,Git Bash 可以工作,~/.ssh/config 文件已存在且可访问 - 我不知所措......

有什么绝妙的想法吗?我当然希望如此!!

更新: @Mark Longair - 这是我的 ~/.ssh/config 文件 - 稍作编辑:-)

Host gerrit
  Hostname git.mycompany.com
  Port 29418
  User myself
  IdentityFile ~/.ssh/gerrit_myself_rsa

我可以 ping git.mycompany.com,但我无法 ping gerrit。有什么想法吗?我是否应该将 gerrit 的条目添加到我的 hosts 文件中,并将其指向与此处 git 服务器相同的 IP?

I am trying to get GIT to work fully in my beloved TakeCommand command-line window on Windows 7.

I installed msysgit v.1.7.3, created my SSH keys and all, and in GIT Bash, everything works just fine and dandy.

But I always have my TakeCommand windows open anyway - so I really don't want Yet Another Command Line Window just for GIT.

Most commands like git status, git add, git commit and so forth work just fine in TakeCommand - the only thing that doesn't work is pull and push.

I have setup a ~/.ssh/config file that points to my company's central repo, and in Git Bash, everything works just fine. But in TakeCommand, I get:

D:\myGitProject> git pull "origin" master:master

ssh: gerrit: no address associated with name
fatal: The remote end hung up unexpectedly

WTF?!?!? Same with git push - what's going on here?? My SSH is set up, Git Bash works, the ~/.ssh/config file is there and accessible - I'm at a loss.....

Any brilliant ideas? I sure hope so!!

Update: for @Mark Longair - here's my ~/.ssh/config file - slightly edited :-)

Host gerrit
  Hostname git.mycompany.com
  Port 29418
  User myself
  IdentityFile ~/.ssh/gerrit_myself_rsa

I can ping git.mycompany.com, but I cannot ping gerrit. Any ideas? Should I add an entry for gerrit into my hosts file and point it to the same IP as the git server here??

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

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

发布评论

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

评论(1

筑梦 2024-11-14 14:54:52

要在最后回答您的问题,您可以将 gerrit 添加到您的主机文件中,但这不会让您自定义端口,并且无助于理解问题 - 为你的 SSH 配置中的 host 应该可以工作!

我怀疑 ~/.ssh/config 文件根本没有被读取,可能是因为 SSH 正在不同的位置查找它。要测试这一点,只需尝试:

ssh gerrit

这应该会产生相同的错误。然后,要获取更多信息,请尝试:

ssh -v gerrit

如果它工作成功,输出应以如下所示开始:(

OpenSSH_5.3p1 Debian-3ubuntu6, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /home/mark/.ssh/config
debug1: Applying options for gerrit
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to git.mycompany.com [192.168.0.2] port 22.
[...]

来自 Linux,但它应该与与 msysgit 捆绑在一起的 OpenSSH 客户端类似。)如果您没有看到“读取配置数据 [您的配置文件]”行那么这可能是问题所在。

您能成功连接到:

 ssh [email protected]

...顺便说一下吗?

我要检查的另一件事是命令提示符下的 HOME 设置。

To answer your question at the end, you could add gerrit to your hosts file, but that wouldn't let you customize the port, and doesn't help to understand the problem - specifying a nickname for the host in your SSH config should work!

My suspicion is that the ~/.ssh/config file isn't being read at all, possibly because SSH is looking in a different location for it. To test this, just try:

ssh gerrit

That should just produce the same error. Then, to get more information, try:

ssh -v gerrit

If it's working successfully, the output should begin something like the following:

OpenSSH_5.3p1 Debian-3ubuntu6, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /home/mark/.ssh/config
debug1: Applying options for gerrit
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to git.mycompany.com [192.168.0.2] port 22.
[...]

(That's from Linux, but it should be similar from the OpenSSH client bundled with msysgit.) If you don't see the "Reading configuration data [your config file]" line then that's likely to be the problem.

Can you successfully connect with:

 ssh [email protected]

... incidentally?

The other thing that I would check is what HOME is set to at the command prompt.

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