我试图在Windows 7环境中配置Jenkins以使用Bitbucket上的Git存储库,但是当我尝试进行构建时 - 我收到以下错误.
这是我正在使用的存储库URL:
https://: @bitbucket.org/ / .git
不确定我是否需要为Jenkins-Bitbucket生成密钥,如果是,有人可以提供有关如何为Windows执行此操作的详细说明吗?
Started by user anonymous Building in workspace C:\Users\\.jenkins\workspace\ Fetching changes from the remote Git repository Fetching upstream changes from https:// @bitbucket.org/ / .git FATAL: Failed to fetch from https:// @bitbucket.org/ / .git hudson.plugins.git.GitException: Failed to fetch from https:// @bitbucket.org/ / .git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:612) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:836) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:861) at hudson.model.AbstractProject.checkout(AbstractProject.java:1414) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:561) at hudson.model.Run.execute(Run.java:1678) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https:// @bitbucket.org/ / .git +refs/heads/*:refs/remotes/ /*" returned status code 128: stdout: stderr: fatal: Authentication failed for 'https:// @bitbucket.org/ / .git/' at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1098) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:984) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:68) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:217) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.fetch(CliGitAPIImpl.java:223) at hudson.plugins.git.GitAPI.fetch(GitAPI.java:229) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:610) ... 10 more
user1004462.. 7
好的,这对我有用,但首先,我的设置如下:
Windows 7的
Jenkins(使用Git插件)
混帐
账户Bitbucket
我从遵循本教程开始.它适用于Windows,您只需双击"C:\ Program Files(x86)\ Git"中的"Git Bash",然后按照说明生成ssh密钥.我只需要做第2步和第3步.
注意:我生成的密钥没有密码!这是我能让它工作的唯一方法......
然后,使用文本编辑器打开在"C:\ Users\YOUR_WINDOWS_USER_NAME\.ssh"中生成的公钥文件"id_rsa.pub"并复制内容.获得公钥后,需要将其注册到Bitbucket,转到"管理帐户" - >"SSH密钥" - >"添加密钥".粘贴您的公钥并保存.
为了测试密钥,我运行了这个命令:
$ ssh -T git@bitbucket.org logged in as. You can use git or hg to connect to Bitbucket. Shell access is disabled.
现在您需要向Jenkins注册您的私钥:转到"凭据" - >"全局凭据" - >"添加凭据",输入您的用户名,描述(可选),选择"从Jenkins master上的文件"并输入C:\ Users \用户YOUR_WINDOWS_USER_NAME \的.ssh\id_rsa.
最后一步是配置Jenkins作业.在"源代码管理"下,选择"Git",在"存储库URL"下输入:
git@bitbucket.org:/ .git
在"凭据"下,选择您刚刚创建的凭据.
注意:确保当您转到"管理Jenkins" - >"配置系统" - >"Git"时,"Git可执行文件的路径"设置为"C:\ Program Files(x86)\ Git\cmd \"之类的内容git.exe".
按照这些步骤,我可以从存储库中下载我的代码.
好的,这对我有用,但首先,我的设置如下:
Windows 7的
Jenkins(使用Git插件)
混帐
账户Bitbucket
我从遵循本教程开始.它适用于Windows,您只需双击"C:\ Program Files(x86)\ Git"中的"Git Bash",然后按照说明生成ssh密钥.我只需要做第2步和第3步.
注意:我生成的密钥没有密码!这是我能让它工作的唯一方法......
然后,使用文本编辑器打开在"C:\ Users\YOUR_WINDOWS_USER_NAME\.ssh"中生成的公钥文件"id_rsa.pub"并复制内容.获得公钥后,需要将其注册到Bitbucket,转到"管理帐户" - >"SSH密钥" - >"添加密钥".粘贴您的公钥并保存.
为了测试密钥,我运行了这个命令:
$ ssh -T git@bitbucket.org logged in as <USER_ID>. You can use git or hg to connect to Bitbucket. Shell access is disabled.
现在您需要向Jenkins注册您的私钥:转到"凭据" - >"全局凭据" - >"添加凭据",输入您的用户名,描述(可选),选择"从Jenkins master上的文件"并输入C:\ Users \用户YOUR_WINDOWS_USER_NAME \的.ssh\id_rsa.
最后一步是配置Jenkins作业.在"源代码管理"下,选择"Git",在"存储库URL"下输入:
git@bitbucket.org:<USER_ID>/<REPO_NAME>.git
在"凭据"下,选择您刚刚创建的凭据.
注意:确保当您转到"管理Jenkins" - >"配置系统" - >"Git"时,"Git可执行文件的路径"设置为"C:\ Program Files(x86)\ Git\cmd \"之类的内容git.exe".
按照这些步骤,我可以从存储库中下载我的代码.