首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >lerna发布在Jenkins上的"git远程更新“失败”无法从远程存储库读取“。

lerna发布在Jenkins上的"git远程更新“失败”无法从远程存储库读取“。
EN

Stack Overflow用户
提问于 2018-04-24 03:51:06
回答 2查看 4.8K关注 0票数 5

我正在尝试设置lernajenkins,以便在所有测试通过后发布。我有命令在运行,但失败了。

我找不到任何关于如何让它工作的文档。我需要这个命令来将lerna标记以及更新的版本号推送到主分支,我还需要Jenkins不要陷入无限循环。

我的第一个问题是:

代码语言:javascript
复制
> lerna publish --yes --cd-version=patch

lerna info version 3.0.0-beta.17
lerna info versioning independent
lerna ERR! ENOGIT Detached git HEAD, please checkout a branch to publish changes.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abide@1.0.0 publish: `lerna publish --yes --cd-version=patch`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the abide@1.0.0 publish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2018-04-24T03_18_59_152Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abide@1.0.0 jenkins: `npm run versions && npm run test && npm run publish`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the abide@1.0.0 jenkins script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2018-04-24T03_18_59_167Z-debug.log
Build step 'Execute shell' marked build as failure
Finished: FAILURE

我通过这样做修正了这个问题:Jenkins Git plugin detached HEAD

以下是我所设定的一切:

现在我有个问题:

代码语言:javascript
复制
> lerna publish --yes --cd-version=patch

lerna info version 3.0.0-beta.17
lerna info versioning independent
lerna ERR! Error: Command failed: git remote update
lerna ERR! Permission denied (publickey).
lerna ERR! fatal: Could not read from remote repository.
lerna ERR! 
lerna ERR! Please make sure you have the correct access rights
lerna ERR! and the repository exists.
lerna ERR! error: Could not fetch origin
lerna ERR! 
lerna ERR! Fetching origin
lerna ERR! 
lerna ERR!     at makeError (/var/lib/jenkins/workspace/abide/node_modules/@lerna/child-process/node_modules/execa/index.js:169:9)
lerna ERR!     at Function.module.exports.sync (/var/lib/jenkins/workspace/abide/node_modules/@lerna/child-process/node_modules/execa/index.js:338:15)
lerna ERR!     at Object.execSync (/var/lib/jenkins/workspace/abide/node_modules/@lerna/child-process/index.js:21:16)
lerna ERR!     at Object.isBehindUpstream (/var/lib/jenkins/workspace/abide/node_modules/@lerna/git-utils/index.js:206:25)
lerna ERR!     at PublishCommand.initialize (/var/lib/jenkins/workspace/abide/node_modules/@lerna/publish/index.js:92:24)
lerna ERR!     at Promise.resolve.then (/var/lib/jenkins/workspace/abide/node_modules/@lerna/command/index.js:228:24)
lerna ERR! lerna Command failed: git remote update
lerna ERR! lerna Permission denied (publickey).
lerna ERR! lerna fatal: Could not read from remote repository.
lerna ERR! lerna 
lerna ERR! lerna Please make sure you have the correct access rights
lerna ERR! lerna and the repository exists.
lerna ERR! lerna error: Could not fetch origin
lerna ERR! lerna 
lerna ERR! lerna Fetching origin
lerna ERR! lerna 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abide@1.0.0 publish: `lerna publish --yes --cd-version=patch`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the abide@1.0.0 publish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2018-04-24T03_29_06_133Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abide@1.0.0 jenkins: `npm run versions && npm run test && npm run publish`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the abide@1.0.0 jenkins script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2018-04-24T03_29_06_144Z-debug.log
Build step 'Execute shell' marked build as failure
Finished: FAILURE

我怎样才能让lerna publish在詹金斯工作?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-04-24 04:04:16

我输入了jenkins框,cd进入了工作区。

我运行了git remote update,它显示如下:

警告:将IP地址'192.30.253.112‘的RSA主机密钥永久添加到已知主机列表中。

似乎我没有github的IP添加。

票数 0
EN

Stack Overflow用户

发布于 2018-04-24 04:40:46

您需要确保Jenkins在Jenkins框上运行哪个帐户:

如果您拥有正确的~/.ssh/id_rsa(.pub)私钥/公钥,Jenkins必须与该用户一起运行以反映正确的归属。

如果您可以连接到Jenkins机器,那么可以用以下方法测试ssh连接:

代码语言:javascript
复制
cd /apth/to/repo
git remote -v
  # should return an ssh URL
  # like:
  # git@aserver.com
ssh -T git@aserver.com

OP ThomasReggi通过以下方式确认帐户问题in the comments

我已经通过root进入机器,并且可以查看访问权限。 我正在使用Git插件在Jenkins中解压回购程序,但现在lerna运行在该插件之外,需要ssh访问回购,在用户级别上是不可用的。 我所需要做的就是添加SSH代理插件,并在我的工作配置中使用我用来设置GitHub插件的SSH凭据。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49993136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档