cygwin和windows git - 路径混乱 [英] cygwin and windows git - path confusion

查看:226
本文介绍了cygwin和windows git - 路径混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助使用安装在windows下的git从cygwin shell正常工作。



我看到git在cygwin shell下调用时不能很好地解释路径。 / p>

  $ git --version 
git version 1.8.0.msysgit.0

git config --global --add user.name miten.mehta

错误:无法锁定配置文件D:\software\cygwin\home\Miten Mehta / .gitconfig:Permission denied


解决方案

Cygwin是一个POSIX仿真层工具和程序依赖于它的功能)。 Git安装的Windows是一个本机 Windows应用程序,它不使用Cygwin并且不了解它。



路径名的问题可能是由于事实GfW和Cygwin运行时都使用某些怪癖在Windows上使用路径名。



你应该做的是决定你究竟需要什么。 p>


  • GfW在任何Windows shell(正常 cmd.exe (例如 Console2 ,PowerShell等),还有自己的Windows端口 bash Git Bash)。



    因此,一种方法只是为Windows采用更好的shell。


  • 需要Cygwin,然后按照Steven&mdash的建议使用它的本地工具;也就是使用Cygwin工具安装Cygwin的Git,然后在Cygwin shell中使用它。




请注意,如果你想使用一个流行的第三方GUI前端Git,如Git扩展或TortoiseGit,你需要Git Windows。因此,我的个人选择是使用GfW,除非您需要Cygwin用于其他目的,或者可以在Cygwin的生态系统中使用Git。


I need help to use git installed under windows to work well from cygwin shell.

I see that git is not interpreting path well when invoked under cygwin shell.

$ git --version
git version 1.8.0.msysgit.0

$ git config --global --add user.name miten.mehta

error: could not lock config file D:\software\cygwin\home\Miten Mehta/.gitconfig: Permission denied

解决方案

Cygwin is a POSIX emulation layer (and a set of tools and programs relying on it to function) for Windows. Git for Windows, which you installed, is a native Windows application which does not use Cygwin and knows nothing about it.

The problem with pathnames is probably due to the fact GfW and Cygwin runtime both use certain quirks to work with pathnames on Windows.

What you should do is decide what exactly is your need.

  • GfW works perfectly in any Windows shell (regular cmd.exe, 3rd-party emulators like Console2, PowerShell etc), and also comes with its own Windows port of the bash shell (called Git Bash).

    Hence one approach is just to adopt a better shell for Windows.

  • If you think you need Cygwin, then use its native tools as suggested by Steven—that is, install Git for Cygwin using Cygwin tools, and then use it in the Cygwin shell only.

Note that if you'll want to use one of popular 3rd-party GUI front-ends for Git, such as Git Extensions or TortoiseGit, you'll need Git for Windows. So my personal pick is to use GfW unless you need Cygwin for other purposes or are okay with working with Git within the Cygwin's ecosystem.

这篇关于cygwin和windows git - 路径混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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