zoukankan      html  css  js  c++  java
  • Jenkins连接Git仓库时候报错Permission denied, please try again.

    一、连接GIT仓库报错

    Failed to connect to repository : Command "git ls-remote -h git@192.168.5.71:/home/git/www.git HEAD" returned status code 128:
    stdout:
    stderr: Permission denied, please try again.
    Permission denied, please try again.
    Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.

     二、问题原因

    我是通过yum安装的Jenkins,安装过程中创建了jenkins用户,并作为service以这个用户来运行。所以无论是root还是当前用户的ssh key都是不生效的。

    # ps aux | grep jenkins
    jenkins   2528 13.4 15.2 3665292 591388 ?      Ssl  Nov18 155:31 /etc/alternatives/java -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20

    三、解决方法

    最简单的方法是把服务用户由jenkins修改为root

    # sed -n '29p' /etc/sysconfig/jenkins 
    JENKINS_USER="root"
    # systemctl restart jenkins.service 
    # ps aux | grep jenkins
    root     19132  169  5.8 3563124 225760 ?      Ssl  09:59   0:06 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20

    另一种就是为jenkins这个用户再生成ssh key,然后设置到git系统

  • 相关阅读:
    学习 Apache FileMatchs 规则
    yii2 vendor/bower/jquery/dist not exist
    Ionic POST提交使用普通表单提交数据
    Yii2 在php 7.2环境下运行,提示 Cannot use ‘Object’ as class name
    Yii2 使用 npm 安装的包
    phpStorm 激活
    Chrome DNS_PROBE_FINISHED_NXDOMAIN
    Yii2 中使用ts
    Js 对 浏览器 的 URL的操作
    js 编码、解码与asp.net 编码、解码
  • 原文地址:https://www.cnblogs.com/cyleon/p/11887412.html
Copyright © 2011-2022 走看看