我有2个GIT仓库副本,我们称之为“原产地”和“备份”。我想要达到的是以下几点。 我的团队经常不停地推动并同步他们的变化到“原产地”,但是我想确保我有一个“原产地”在不同地理位置的副本,它将作为副本,以防万一发生火灾打算破坏我办公室里的一切。为了实现这一目标,我一直保存着我在云端托管的git repo的相同副本。Jenkins没有检测到Windows凭据管理器的GIT凭据
现在用詹金斯的组合和一个Windows批处理脚本我试图找出一个办法,我可以把这些库的同步。批处理脚本将负责实际的同步操作,Jenkins将确保同步操作定期运行。复制副本名为“备份”(正如您可能已经猜到的那样)。
问题是,当我直接从命令提示符运行批处理脚本时,它完全按照我的需要执行;但是,当我尝试通过Jenkins作业执行批处理脚本时,它一直在等待存储库的用户名和密码“备份”。 “backup”存储库的凭据已存储在Windows Credential管理器中,批处理脚本可以在直接执行时使用凭据,但不知何故,当我尝试通过Jenkins执行时,情况并非如此。
我曾试着用搜索引擎,搜索所以即使做了很多的搜索,看看我能找到詹金斯论坛的东西,但到目前为止,我还没有发现任何有用的。
我不确定这是否有用,但下面是我的批处理脚本供参考。
@echo OFF
pushd K:
pushd "K:\my-git-workspace\mygit-repo"
echo Pulling "master" from origin
git pull origin master
echo Pulling "master" from backup
git pull backup master
echo Pushing "master" to backup
git push backup master
echo Pushing "master" to origin
git push origin master
echo Pulling all tags from origin
git pull --tags origin
echo Pulling all tags from backup
git pull --tags origin
echo Pushing all tags to backup
git push --tags backup
echo Pushing all tags to origin
git push --tags origin
popd
这是我的GIT配置,我从窗户看到命令提示。(I已经取代了user.name和user.email虚拟值)
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
[email protected]
user.name=My Name
credential.helper=wincred
这里是GIT构造我从詹金斯
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
[email protected]
user.name=My Name
credential.helper=wincred
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=//networkrepo/git/repo
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.backup.url=http://cloud-hosted-git-repo/repo.git
remote.backup.fetch=+refs/heads/*:refs/remotes/backup/*
gui.wmstate=zoomed
gui.geometry=584x210+321+316 304 192
credential.helper=store
[email protected]
user.name=My Name
运行(混帐配置-l)时,不用说,任何帮助是极大的赞赏。
干杯。
你的git配置('git config -l')怎么样?直接运行和通过jenkins运行有区别吗? – eis 2015-02-06 13:07:05
也不是wincred用户特定 - 你是否确定你使用同一个用户詹金斯和当你直接运行它? – eis 2015-02-06 13:08:17
wincred用户在使用jenkins并直接运行时是相同的。 – parth6 2015-02-06 13:09:48