git - Jenkins Git 插件 - 401

标签 git github jenkins

我尝试了各种不同的方法,但我无法让 jenkins 很好地使用 git。

我已经设置了我的 ssh key 并验证了我可以通过 ssh 连接到 git hub 并且我收到了消息。 我也尝试过不使用 .git 扩展名。我试过在 url 中使用用户名,在 url 中使用用户名和密码,但根本没有用户名/密码。没关系。

我还尝试过使用管理员用户和普通推/pull 用户。

我试图访问的 git 存储库是通过一个“组织”,但我在一个有访问权限的团队中。

Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone https://github.com/xxx/xx
hudson.plugins.git.GitException: Could not clone https://github.com/xxx/xx
    at hudson.plugins.git.GitAPI.clone(GitAPI.java:245)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1073)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1014)
    at hudson.FilePath.act(FilePath.java:788)
    at hudson.FilePath.act(FilePath.java:770)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1014)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1195)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:579)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:468)
    at hudson.model.Run.run(Run.java:1408)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:478)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:238)
Caused by: hudson.plugins.git.GitException: Error performing command: git clone --progress -o origin https://github.com/xxxx/xx /var/lib/jenkins/jobs/test/workspace
Command "git clone --progress -o origin https://github.com/xxxx/xx /var/lib/jenkins/jobs/test/workspace" returned status code 128: Initialized empty Git repository in /var/lib/jenkins/jobs/test/workspace/.git/
error: The requested URL returned error: 401 while accessing https://github.com/xxxx/xx/info/refs

最佳答案

尝试使用 r/w 地址通过 ssh key 克隆私有(private)存储库:

git@github.com:xxx/xx.git

关于git - Jenkins Git 插件 - 401,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9553803/

相关文章:

git - 'git rm' 和 'git mv' 与 git 的实际用例?

git - 如何获得直接链接到github LFS(大文件存储)中的文件?

jenkins - 为什么 MSbuild 不使用 Jenkins 在单个操作中构建多个项目?

python - Django 项目和 git

windows - 在 Windows 上将 GitHub 存储库下载为 zip,包括 CRLF

javascript - github 项目页面资源解释为脚本,但使用 MIME 类型 text/htm 传输

html - 如何链接到github上的html

docker - 如何使用 Jenkins 声明式管道在远程 Docker 服务器上构建?

未找到 Android SDK 位置

Git:如何只列出本地分支机构?