如何在Cygwin中获得Git 1.8?

时间:2013-01-15 02:00:38

标签: git cygwin

根据http://cygwin.com/packages/git/,最新的Cygwin软件包是1.7.9-1。

我想将git更新为至少1.8.0。

我可以这样做吗?

7 个答案:

答案 0 :(得分:46)

cygwinports有许多新版本的各种工具

当我写这篇文章时,它有1.8.3.4

  

新的简化安装说明:

     
      
  • 使用最新的Cygwin安装程序(至少版本2.829):32位的setup-x86.exe或64位的setup-x86_64.exe。 (注意   许多软件包尚未移植到x86_64。)
  •   
  • 使用-K标志启动setup - * .exe,例如:

         

    cygstart - /path/to/setup-x86.exe -K http://cygwinports.org/ports.gpg

  •   
  • 在“选择安装类型”页面上,选择“从Internet安装”。

  •   
  • 在“选择下载站点”页面上,选择一个发行镜像,然后在“用户URL”字段中输入ftp://ftp.cygwinports.org/pub/cygwinports   然后按添加(确保两者都突出显示)。      
        
    1. 或者,您可以使用源软件镜像,但如果这样做,则必须使用托管在与所选服务器不同的服务器上的镜像   发行镜。
    2.   
  •   
  • 继续选择和安装软件包,确保安装任何指示的依赖项。
  •   

答案 1 :(得分:28)

要安装git 1.8.0,您需要编译源代码。

您需要克隆git存储库(git clone https://github.com/git/git.git),输入git目录,将当前版本更改为1.8.0或其他所需版本(git checkout v.1.8.0)并键入以下命令:

make configure
./configure --prefix=/usr/local
make
make install

它将在/usr/local目录下安装git。有关git安装的更多信息,例如文档,您可以查看本地化在git repository root中的INSTALL文件。

答案 2 :(得分:7)

我按照these instructions成功安装了git 1.8.4.474;我正在运行Windows 7 64位,cygwin版本1.7.22(0.268 / 5/3)

  
      
  1. 运行Cygwin设置实用程序并确保安装了以下软件包:

    gcc
    autoconf
    curl
    libcurl-devel, required for http/https support 
                   (NOTE: this is an obsolete package, you will need to
                   uncheck "Hide obsolete packages" when selecting packages
                   to install)
    make
    libiconv
    python
    perl
    gettext
    
         

    您可能需要libiconv-devel和cygwin32-liviconv(参见Marek的评论)

  2.   
  3. 使用git clone https://github.com/git/git.git克隆Git源代码。关于Git配置的一些注意事项:

         

    确保core.autocrlf=false,否则您最终会遇到导致构建中断的DOS样式行结尾。

         

    我还有一个棘手的http.sslcainfo属性值;要么取消设置,要么将其指向/usr/ssl/certs/ca-bundle.crt

  4.   
  5. 从新克隆的git repo中,运行以下命令:

    make configure
    ./configure
    make
    make install
    
  6.   

答案 3 :(得分:3)

你的指示对我来说并没有真正起作用......

我遵循了这些说明(确保安装了所有正确的软件包)

http://randomartifacts.blogspot.com/2013/04/compiling-git-on-cygwin.html

修改了Makefile

$ git diff Makefile
diff --git a/Makefile b/Makefile
index 3588ca1..90f337c 100644
--- a/Makefile
+++ b/Makefile
@@ -407,7 +407,7 @@ RPMBUILD = rpmbuild
 TCL_PATH = tclsh
 TCLTK_PATH = wish
 XGETTEXT = xgettext
-MSGFMT = msgfmt
+MSGFMT = msgfmt.py
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
 GCOV = gcov

然后

make configure NO_MSGFMT_EXTENDED_OPTIONS=1
./configure
make NO_MSGFMT_EXTENDED_OPTIONS=1
make install NO_MSGFMT_EXTENDED_OPTIONS=1

不确定所有make命令是否需要param,但这对我有用

答案 4 :(得分:2)

我在做“make install”时遇到了问题。错误消息是:

  

安装-d -m 755'/ usr / local / bin'
  git:'安装'不是git命令。见'git --help'   ./install:第4行:通常:命令未找到
  ./install:第5行:将:命令未找到
  ./install:第6行:to:命令未找到
  ./install:第8行:$:命令未找到
  ./install:第11行:意外令牌.'
./install: line 11:
附近的语法错误(当然,前缀= / usr / local)。就像任何程序套件'

一样

这是因为如果PATH中有“./”,则Windows操作系统不区分大小写。 Cygwin使用git源代码树中的INSTALL文件而不是/ usr / bin / install。我们必须将源树中的一些“INSTALL”文件重命名为其他文件名。 http://zengrong.net/post/1817.htm

提到了这一点

答案 5 :(得分:1)

我有一个问题,这花了我一个小时来调试,所以我发布了一个答案,以防其他人来这里看。

实际上它与Yorkwar的原因相同,但错误不同。

make install输出之前一切正常:

$ make install
    GEN perl/PM.stamp
    SUBDIR gitweb
    SUBDIR ../
make[2]: 'GIT-VERSION-FILE' is up to date.
    GEN git-instaweb
    BUILTIN all
    SUBDIR git-gui
    SUBDIR gitk-git
    SUBDIR perl
    SUBDIR templates
install -d -m 755 '/usr/local/bin'
make: execvp: install: Permission denied
Makefile:2342: recipe for target 'install' failed
make: *** [install] Error 127

经过大量的UAC,setuid,icacls,所有权等问题后,我通过strace发现实际问题是执行install时:我已经./了我的PATH和Windows不区分大小写,它会尝试执行INSTALL,这是一个没有设置x位的文本文件。所以"权限被拒绝"指的是未在此文件上设置x的事实。

@Yorkwar通过重命名所有INSTALL文件来修复此问题,但另一个选项是编辑Makefile并替换

INSTALL = install

INSTALL = /usr/bin/install

我在Windows 7 64位中使用cygwin 32位(在cygwin64出来之前安装它并且还没有为升级而烦恼)。已成功构建并安装git version 2.0.0.rc4.dirty的结果git clone https://github.com/git/git.git

答案 6 :(得分:-1)

您可以从git-scm.com/download/win安装Windows平台的最新版本。

将以下内容添加到~/.profile

export PATH=$PATH:`cygpath 'C:\Program Files (x86)\Git\bin'`

我将来自SourceTree和cygwin的git客户端与Gerrit / SSH服务器结合使用,并且还没有遇到任何问题。

相关问题