赞
踩
无法连接仓库:Command “git ls-remote -h – git@codeup.aliyun.com:xxxxxxxxxxxxxxx/xxxxxx.git HEAD” returned status code 128:
stdout:
stderr: Load key “/tmp/jenkins-gitclient-ssh14549883685367104196.key”: error in libcrypto
git@codeup.aliyun.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
![(https://img-blog.csdnimg.cn/direct/a6d0f353eef34591b673d3dfd9dd5c14.png)
注意:这里我的jenkins启动用户是jenkins,如果是root则在root用户下生成密钥。那个用户启动用哪个用户生成!
sudo su -s /bin/bash jenkins
cd ~
ssh-keygen -m PEM -t rsa -f id_rsa
# ssh-keygen -t rsa(这个不行)
cat .ssh/id_rsa.pub
或者
cat id_rsa.pub
实际应该将ssh-keygen生成的id_rsa文件中的全部内容粘贴到Jenkins的凭据private key那里,同时要包含首行与尾行。
执行一下这个
git ls-remote -h -- git@codeup.aliyun.com:64fxxxxxxxxxxxxxxx_demo.git HEAD
最后保存在配置就可以了
如:
cp: cannot create regular file '/date/jenkins-publish.tar': Permission denied
修改jenkins的配置问卷,我使用的是Ubuntu的apt包管理器安装的在 /etc/default/jenkins
vim /etc/default/jenkins # defaults for Jenkins automation server # pulled in from the init script; makes things easier. #NAME=jenkins 这个是默认的用户 NAME=root # 这个是修改为执行用户为root # arguments to pass to java # Allow graphs etc. to work even when an X server is present JAVA_ARGS="-Djava.awt.headless=true" #JAVA_ARGS="-Xmx256m" # make jenkins listen on IPv4 address #JAVA_ARGS="-Djava.net.preferIPv4Stack=true" PIDFILE=/var/run/$NAME/$NAME.pid # user and group to be invoked as (default to jenkins) JENKINS_USER=$NAME JENKINS_GROUP=$NAME # location of the jenkins war file JENKINS_WAR=/usr/share/java/$NAME.war
之后重启jenkins就可以了
这个可以
给jenkins添加对应文件夹的权限
chown -R jenkins /data
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。