2011-09-25 13 views
6

Gdtlite çalışmamın jenkins ile çalışmasını sağlamak için günlerce çalışıyorum, böylece sunucuda barındırılan ve Jenkins ile çalışarak repos yapabilirim. aynı ciddiyetle).Başarılı çalışmak için jenkins ve gitolite almaya çalışıyorum - İzin reddedildi (publickey, parola)

Gitolit çalışıyorum ama sanırım ssh ile ilgili problemlerim var. Sohbet konusunda yardım aldım ve jenkins/.ssh'e özel anahtar ekledim.

Gitolit'i barındıran bir kullanıcı "git" var ve bir kullanıcı "gitolite" ve bir "jenkins" kullanıcısı var. Bir repo'yu git clone [email protected]: Matrix

kullanarak klonlayabilirim ama bunu jenkins'de kullanamıyorum. Bunu yapmaya çalıştığımda anladım. ardından "ssh -v git @ sunucu" Ben bu olsun yazın jenkins -

Checkout:workspace//var/lib/jenkins/jobs/Matrix/workspace - 
[email protected] 
Using strategy: Default 
Checkout:workspace//var/lib/jenkins/jobs/Matrix/workspace - 
[email protected] 

Cloning the remote Git repository 
Cloning repository origin 
ERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:Matrix 
ERROR: Cause: Error performing command: git clone --progress -o origin [email protected]:Matrix /var/lib/jenkins/jobs/Matrix/workspace 
Command "git clone --progress -o origin [email protected]:Matrix 
/var/lib/jenkins/jobs/Matrix/workspace" returned status code 128: Cloning into  /var/lib/jenkins/jobs/Matrix/workspace... 
Permission denied, please try again. 
Permission denied, please try again. 
Permission denied (publickey,password). 
fatal: The remote end hung up unexpectedly 

Trying next repository 
ERROR: Could not clone repository 
FATAL: Could not clone 
hudson.plugins.git.GitException: Could not clone 
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1042) 
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:968) 
at hudson.FilePath.act(FilePath.java:758) 
at hudson.FilePath.act(FilePath.java:740) 
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:968) 
at hudson.model.AbstractProject.checkout(AbstractProject.java:1193) 
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:566) 
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:454) 
at hudson.model.Run.run(Run.java:1376) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 
at hudson.model.ResourceController.execute(ResourceController.java:88) 
at hudson.model.Executor.run(Executor.java:230) 

benim sunucu ve su giriş.

[email protected]:~$ sudo su - jenkins 
[email protected]:~$ ssh -v [email protected] 
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * 
debug1: Connecting to server [127.0.1.1] port 22. 
debug1: Connection established. 
debug1: identity file /var/lib/jenkins/.ssh/id_rsa type -1 
debug1: identity file /var/lib/jenkins/.ssh/id_rsa-cert type -1 
debug1: identity file /var/lib/jenkins/.ssh/id_dsa type -1 
debug1: identity file /var/lib/jenkins/.ssh/id_dsa-cert type -1 
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa type -1 
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa-cert type -1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1 Debian-1ubuntu3 
debug1: match: OpenSSH_5.8p1 Debian-1ubuntu3 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_5.8p1 Debian-1ubuntu3 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-md5 none 
debug1: kex: client->server aes128-ctr hmac-md5 none 
debug1: sending SSH2_MSG_KEX_ECDH_INIT 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ECDSA f3:ab:a6:55:83:98:c5:4f:85:c6:70:be:2f:40:1f:65 
debug1: Host 'server' is known and matches the ECDSA host key. 
debug1: Found key in /var/lib/jenkins/.ssh/known_hosts:3 
debug1: ssh_ecdsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: Roaming not allowed by server 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Trying private key: /var/lib/jenkins/.ssh/id_rsa 
debug1: read PEM private key done: type RSA 
debug1: Authentications that can continue: publickey,password 
debug1: Trying private key: /var/lib/jenkins/.ssh/id_dsa 
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ecdsa 
debug1: Next authentication method: password 
[email protected]'s password: 

Hala şifre sorar ... yapmış herkes? Jenkins'la çalışarak gitolit almak mı? Herhangi bir yardım için çok minnettarım ve bunu yapmama yardımcı olmak için 10 dolar (vize kartı) memnuniyetle bağışlayabilirim!

+1

SSH günlüğüne göre, "id_rsa" özel anahtarınız sunucu tarafından kabul edilmiyor. Gitolite'ın özel anahtarla eşleşen ortak anahtarı olduğunu ve gitolite'ın bu tuşla ~/git/.ssh/authorized_keys dosyasını doğru şekilde güncellediğini kontrol edin. –

+0

Cevabınız için teşekkürler! Şu an ona bakıyorum ama bunun nasıl üstesinden geleceğimi bilmiyorum. Jenkins'da bir şey yapamam, ama düşünmeyi düşündüğümden emin değilim. Eğer benim matchbook yanlısı var ve benim sunucuya erişmeye çalışıyorum sadece ssh e-ject.se yazacağım varsayalım? hangi yetkilere ihtiyacım var? Benim iMac sunucusuna, MacBook'um sunucuya jenkins'e? ve gitolit mi? Bir git kullanıcı git ana kullanıcı ubuntu üzerinde git clone [email protected] kullanabilirsiniz: Matrix ama jenkins kabul etmek ve klonlamak için ne gerekir? cevaplar için çok müteşekkirim ve bağış vaadi (visa kartı req) Joniz – Jonathan

+0

bunu devam ettireceğim ve bunun yerine bu kılavuzu deneyin! http://www.nomachetejuggling.com/2011/07/31/ubuntu-tomcat-jenkins-git-ssh-togethe/ bunun nasıl gideceğini görelim. – Jonathan

cevap

14

Jenkins kutuya SSH ve Jenkins kullanıcı için SSH anahtar çifti oluşturmak (burada jenkins varsayarak):

local$ ssh jenkins-box 
[email protected]$ sudo su jenkins 
[email protected]$ ssh-keygen 
[email protected]$ cat $HOME/.ssh/id_rsa.pub 

Kopyalama ekranda gördüğünüz ve yeni bir dosya keydir/jenkins.pub yapıştırın SSH genel anahtar yerel gitolit yönetici deponuzun içinde.

klonlamak ve tüm depoları çekmeye Jenkins izinlerini vermek conf/gitolite.conf aşağıdaki satırları ekleyin:

repo @all 
     R  = jenkins 

kalınması ve gitolite admin deposunu itin. Jenkins şimdi doğru şekilde çalışmalı.

+0

Teşekkür ederim, sorunum için mükemmel çalıştı –

+1

Bazı kurulumlarda 'jenkins' kullanıcısının bir giriş değil, bir sistem/daemon kullanıcısı olduğunu unutmayın. Bu durumlarda 'sudo-u jenkins' komutlarını çalıştırmadan önce iyi çalışmalı (benim durumumda el ile'/home/jenkins' oluşturmak zorunda kaldım). Ayrıca jenkins olarak bir test klonu çalıştırdığınızdan emin olun: 'sudo -u jenkins clone git @ server: repo ~/testclone' –

+0

Önceki yorumum için düzeltme:' sudo -u jenkins git clone git @ server: repo ~/testclone' –

İlgili konular