如何git推送到詹金斯的映射驱动器

时间:2013-08-08 00:23:18

标签: git jenkins cygwin

我有一个构建.NET代码的Jenkins构建框(显然是Windows操作系统),然后将新二进制文件复制到本地git repo中,创建一个具有当前内部版本号的新分支。远程主服务器位于映射驱动器上(在本例中为G:),虽然我可以在Cygwin控制台或Git Bash中使用Jenkins将新分支推送到它,但同样的命令会返回错误:

fatal: 'C:/Program Files/Git/cygdrive/g/repo.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

fatal: 'C:/Program Files/Git/cygdrive/g/repo.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Jenkins shell中的git命令是:

!/bin/bash
cd ../GIT_REPO
git add -A
git commit -m "Updated CI build for version $BUILD_VERSION_NUMBER_NEW based on $ACCUREVCOMMENT.  This build was triggered by $BUILD_CAUSE"
git branch "RC_$BUILD_VERSION_NUMBER_NEW"
git push file:///cygdrive/g/repo.git "RC_6.0"
git push file:///cygdrive/g/repo.git "RC_$BUILD_VERSION_NUMBER_NEW"

为什么Jenkins将C:/ Program Files / Git / cygdrive放在那里?我让Jenkins设置了c:\ cygwin \ bin for git。

1 个答案:

答案 0 :(得分:0)

  

Jenkins为什么要放置C:/ Program Files / Git / cygdrive

因为Cygwin中的/是由MsysGit(Windows的旧git)通过Git的安装路径进行翻译的。

现在(2018年,五年后),不再需要cygwin,您可以使用NAME STATUS ROLES AGE VERSION cb2.4xyz.couchbase.com Ready custom,worker 35m v1.11.1 cb3.5xyz.couchbase.com Ready worker 29m v1.11.1 路径。