Невозможно войти в Github с помощью конвейера Jenkins. - PullRequest
0 голосов
/ 11 апреля 2020

Я хочу клонировать репозиторий github, используя расшифровочный конвейер Jenkins. Я использую следующий код:

pipeline {
   agent any
   stages {
    stage('Checkout') {
      steps {
        script {
           // The below will clone your repo and will be checked out to master branch by default.
           git credentialsId: 'jenkins-user-github', url: 'https://github.com/aakashsehgal/FMU'
           // Do a ls -lart to view all the files are cloned. It will be clonned. This is just for you to be sure about it.
           //bat "ls -lart ./*" 
           // List all branches in your repo. 
           bat "git branch -a"
           // Checkout to a specific branch in your repo.

          }
       }
    }
  }
}

Но Дженкинс не может войти в учетную запись Github. Я дважды проверил учетные данные, и они верны. Вот ошибка:

Started by user Aakash Sehgal
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in C:\Program Files (x86)\Jenkins\workspace\GitHub
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout)
[Pipeline] script
[Pipeline] {
[Pipeline] git
using credential jenkins-user-github
 > git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url https://github.com/aakashsehgal/FMU # timeout=10
Fetching upstream changes from https://github.com/aakashsehgal/FMU
 > git.exe --version # timeout=10
using GIT_ASKPASS to set credentials 
 > git.exe fetch --tags --force --progress -- https://github.com/aakashsehgal/FMU +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/aakashsehgal/FMU
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1131)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: hudson.plugins.git.GitException: Command "git.exe fetch --tags --force --progress -- https://github.com/aakashsehgal/FMU +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Logon failed, use ctrl+c to cancel basic credential prompt.
warning: invalid credential line: get
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/aakashsehgal/FMU/'

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2044)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:81)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:569)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:907)
    ... 11 more
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

Я также искал в Интернете, и кто-то упоминает, что это может быть из-за https. Однако не ясно, как решить это. Есть идеи, что я могу делать не так?

1 Ответ

0 голосов
/ 12 апреля 2020

Итак, после некоторых исследований я наконец нашел ответ. Проблема заключалась в том, что Jenkins не удалось определить путь к исполняемому файлу Git.

Go для управления Jenkins -> Global Configuration Configuration. Под вкладкой Git нам нужно указать абсолютный путь к исполняемому файлу Git. Для стандартной установки путь по умолчанию - C:\Program Files\Git\bin\git.exe. Сохраните это и попробуйте еще раз. Работы.

...