Проблем с конфигурацията на Jenkins и Git

Използвам Git от известно време.

Наскоро започнах да проучвам Jenkins и успях да го настроя с помощта на родния инсталатор на Windows. Създадох примерен проект на моята локална система и го изградих успешно с помощта на Jenkins.

Сега имам проект на отдалечен сървър и искам Дженкинс да изтегли този код с помощта на Git.

Направих следното:

1) Инсталирахте приставката Git. въведете описание на изображението тук

2) В Jenkins > Manage Jenkins > Configure System > Git > Git Installations -

въведете описание на изображението тук

[също опита C:\Program Files (x86)\Git\cmd\gitk.cmd вместо ....\git.exe]

3) Под Тестов проект > Конфигуриране въведете описание на изображението тук

4) Накрая се опитах да го изградя. Но винаги получавате грешка при изчакване и след това грешка. въведете описание на изображението тук

Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\workspace\GitTest
 > C:\Program Files (x86)\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > C:\Program Files (x86)\Git\cmd\git.exe config remote.origin.url ssh://git@<the-url-to-the-server>demo_android.git # timeout=10
Fetching upstream changes from ssh://git@<the-url-to-the-server>demo_android.git
 > C:\Program Files (x86)\Git\cmd\git.exe --version # timeout=10
 > C:\Program Files (x86)\Git\cmd\git.exe fetch --tags --progress ssh://git@<the-url-to-the-server>demo_android.git +refs/heads/*:refs/remotes/origin/* # timeout=60
FATAL: Failed to fetch from ssh://git@<the-url-to-the-server>demo_android.git
hudson.plugins.git.GitException: Failed to fetch from ssh://git@<the-url-to-the-server>demo_android.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:647)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:889)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:914)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1258)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:622)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:528)
    at hudson.model.Run.execute(Run.java:1759)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:89)
    at hudson.model.Executor.run(Executor.java:240)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\cmd\git.exe fetch --tags --progress ssh://git@<the-url-to-the-server>demo_android.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: ssh: connect to host git.us1.adeptra.com port 7999: Bad file number
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1435)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1223)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:85)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:280)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:645)
    ... 10 more

какво правя грешно Трябва ли да предоставя идентификационни данни? (Опитах и ​​това не успя)


person senchaDev    schedule 30.10.2014    source източник
comment
можеш ли да направиш git fetch --tags --progress ssh://git@<the-url-to-the-server>demo_android.git на локалния си компютър?   -  person mithrop    schedule 30.10.2014
comment
да Навигирах до конкретната директория и изпълних командата. Както обикновено, той поиска паролата и след това продължи и се опита да извлече   -  person senchaDev    schedule 30.10.2014


Отговори (3)


Разреших го! SSH ключът имаше парола. Премахнах го и работи добре.

Премахнах паролата, като следвах инструкциите във връзката -

http://www.thinkplexx.com/learn/howto/security/ssl/remove-passphrase-password-from-private-rsa-key

person senchaDev    schedule 06.11.2014

Трябва да предоставите удостоверяване. Или направете това, като използвате обикновен текст и го попълнете в конфигурацията или командния ред, или използвайте сертификат ssh-публичен-ключ, за да направите това.

Тук можете да намерите урок как да го свържете с GitHub и мисля, че трябва да го направите по същия начин сами git-сървър.

person Highmastdon    schedule 30.10.2014
comment
Вече имам файлове id_rsa, id_rsa.pub и unknown_hosts в моята локална система. Къде трябва да осигуря удостоверяването в Jenkins? - person senchaDev; 30.10.2014
comment
Трябва да проверите кой потребител jenkins работи като тест като този потребител. За мен в Linux това би бил самият потребител на Jenkins, като такъв трябва да задам ключовите файлове id_rsa на правилното място за този потребител, което е: home/jenkins/.ssh - person MadManMonty; 30.10.2014
comment
Потребителят, който изпълнява git clone-командата, трябва да изпрати своя (публичен) ssh-ключ на git сървъра - person Highmastdon; 30.10.2014

просто отидете на jenkins -› глобална конфигурация на инструмента -› добавяне на git -› име (по подразбиране) и път към Git изпълним файл (git) -› запазване

person ashok    schedule 28.04.2021