Sudo

sudo 錯誤“需要終端或 -S 選項”

  • August 12, 2020
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/myapp_FrontUAT
using credential 27a4cc0a-d18c-4a8f-bfcd-788d481e12ed
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url git@repos.mydomain.com:root/myapp_Front.git # timeout=10
Fetching upstream changes from git@repos.mydomain.com:root/myapp_Front.git
> /usr/bin/git --version # timeout=10
> git --version # 'git version 2.18.4'
using GIT_SSH to set credentials 
> /usr/bin/git fetch --tags --progress -- git@repos.mydomain.com:root/myapp_Front.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/myapp_Develop^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/myapp_Develop^{commit} # timeout=10
Checking out Revision 30fb4ffa6003e057a053881b7f08a62bd53cb2c1 (refs/remotes/origin/myapp_Develop)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f 30fb4ffa6003e057a053881b7f08a62bd53cb2c1 # timeout=10
Commit message: "update features of ghar naksa."
> /usr/bin/git rev-list --no-walk 30fb4ffa6003e057a053881b7f08a62bd53cb2c1 # timeout=10
Checking for pre-build
Executing pre-build step
Checking if email needs to be generated
No emails were triggered.
[myapp_FrontUAT] $ /bin/sh -xe /tmp/jenkins2383517590544583257.sh
+ sudo git checkout myapp_Develop

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

   #1) Respect the privacy of others.
   #2) Think before you type.
   #3) With great power comes great responsibility.

sudo: a terminal is required to read the password; either use the -S
option to read from standard input or configure an askpass helper
Build step 'Execute shell' marked build as failure Discard old
builds...

#1544 is removed because old than numToKeep
Checking for post-build
Performing post-build step
Checking if email needs to be generated
Email was triggered for: Always
Sending email for trigger: Always
messageContentType = text/plain; charset=UTF-8
Collecting change authors...
   build: 1647
Adding recipients from project recipient list
Analyzing: mymail@mydomain.com
Looking for: mymail@mydomain.com
   starting at: 0
   firstFoundIdx: 0
   firstFoundIdx-substring: mymail@mydomain.com
   => found type: 0
Analyzing: mymail@mydomain.com
Looking for: mymail@mydomain.com
   starting at: 0
   firstFoundIdx: 0
   firstFoundIdx-substring: mymail@mydomain.com
   => found type: 0
Analyzing: mymail@mydomain.com
Looking for: mymail@mydomain.com
   starting at: 0
   firstFoundIdx: 0
   firstFoundIdx-substring: mymail@mydomain.com
   => found type: 0
Adding recipients from trigger recipient list
Setting In-Reply-To since last build was not successful
Successfully created MimeMessage
Sending email to: mymail@mydomain.com
MessagingException message: failed to connect, no password specified?
Finished: FAILURE

我用“-o StrictHostKeyChecking=no”修復了它,而且不以 sudo @gerald-schneider 的身份執行 git 是個好主意

引用自:https://serverfault.com/questions/1029482