我有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