使用 Cygwin 的 Git 推送到远程服务器挂起 [英] Git Push To Remote Server Hangs Using Cygwin

查看:55
本文介绍了使用 Cygwin 的 Git 推送到远程服务器挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是通过命令行接触 git 的新手,遇到了一些我无法摆脱的麻烦.

I'm new to git via the command line and have run into a bit of trouble I haven't been able to pull myself out of.

我已经在我的服务器上设置了一个存储库,并使用 thelucid.com.

I've set up a repository on my server and have created a local directory using the directions at thelucid.com.

在服务器上:

ssh git@example.com
mkdir my_project.git
cd my_project.git
git init --bare
git update-server-info # If planning to serve via HTTP
exit

然后,在本地机器上:

cd my_project
git init
git add *
git commit -m "My initial commit message"
git remote add origin git@example.com:my_project.git
git push -u origin master

当我在这里执行最后一个命令git push -u origin master"时,该命令会挂起并挂起,永远不会停止挂起.

When I get to the final command here "git push -u origin master" the command hangs and hangs and never stops hanging.

本地的 git status 给了我这个:

git status on local gives me this:

$ git status
On branch master
nothing to commit, working directory clean

服务器上的 git status(在 myproject.git/中)给我:

git status on the server (inside myproject.git/)gives me:

$ git status
fatal: This operation must be run in a work tree

我不确定下一步该往哪里看,我尝试了很多方法,但我的无知如山,我可以使用指南;如果你有空的话,也许是一个巫师、一些矮人和霍比特人.任何帮助将不胜感激.

I'm not exactly sure where to look next, I've tried a bunch of things, but my ignorance is mountainous and I could use a guide; maybe a wizard, some dwarves, and hobbit if you have any spares. Any help would be greatly appreciated.

我使用的是 Windows 8.1.使用 Cygwin

I'm on windows 8.1. Using Cygwin

谢谢.

推荐答案

如果您使用的是 Windows,msysgit是更好的选择.已知在 Cygwin 中使用 git push 存在问题.其要点是 Git 默认尝试使用简单密码提示"作为其用户身份验证过程的一部分,如 git-config doc(搜索 core.askpass).但是,此密码提示仅适用于真正的 UNIX,而不适用于 Cygwin.如果有兴趣,您可以在此处阅读有关此问题的历史记录.

If you are using Windows, msysgit is a better option. Using git push in Cygwin is known to have issues. The gist of it is that Git by default, tries to use a "simple password prompt" as part of its user authentication process, as mentioned in the git-config doc(search for core.askpass). This password prompt, however, only works on real UNIX, but not on Cygwin. If interested, you can read about the history of this issue here.

如果您绝对必须使用 Cygwin,请确保按照指定安装 Cygwin git 软件包 这里.然后尝试运行此命令:

If you absolutely have to use Cygwin, then make sure you installed the Cygwin git packages as specified here. Then try run this command:

$ git config --global core.askpass/usr/libexec/git-core/git-gui--askpass

可能还有其他更复杂的解决方案,但我认为最简单的解决方案仍然是安装 msysgit.:-)

There are probably other more involved solutions out there, but I think the simplest solution is still to install msysgit. :-)

这篇关于使用 Cygwin 的 Git 推送到远程服务器挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆