2017-03-03 156 views
1

在我的詹金斯的工作,我在下面的方式配置的git:致命的:無法讀取用戶名,沒有這樣的設備

sh("git config user.email [email protected]") 
sh("git config user.name my-user-name") 
sh("git tag ${BUILD_NUMBER}") 
sh("git push origin --tags") 

然而,在最後一行,當我嘗試推到我的倉庫,我得到關於存儲庫的以下錯誤:

fatal: could not read Username for 'http://my-git-repo.com:8000': No such device or address 

什麼是錯的,我該如何將它推送到存儲庫?

+0

你試過用--global?試試這個:git config --global user.name「my-user-name」 – aicastell

+0

它不是你的git'user.emai/user.name',它是你的'用戶名/密碼'進行驗證。 –

回答

1

您正在尋找credential.username。我不知道的密碼,但如果你不喜歡http://username:[email protected]:8000然後將憑證在Jenkinsfile像這樣:

證書的第二最常見的類型是仍然可以使用「用戶名和密碼」 environment指令,但結果在 中設置了稍微不同的變量。

environment { 
    SAUCE_ACCESS = credentials('sauce-lab-dev') 
} 

這實際上將設置3個環境變量:

SAUCE_ACCESS containing <username>:<password> 
SAUCE_ACCESS_USR containing the username 
SAUCE_ACCESS_PSW containing the password 

credentials僅適用於聲明管道。對於使用腳本管道的 ,請參閱 withCredentials步驟的文檔。

相關問題