首页 \ 问答 \ 为什么Capistrano突然在部署期间无法从我的Bitbucket Git存储库中读取?(Why suddenly is Capistrano unable to read from my Bitbucket Git repository during deploy?)

为什么Capistrano突然在部署期间无法从我的Bitbucket Git存储库中读取?(Why suddenly is Capistrano unable to read from my Bitbucket Git repository during deploy?)

我使用Capistrano(v3.5.0)使用在Bitbucket上设置的部署密钥,将本地开发机器上的小型Rails应用程序部署到Linode上托管的VPS。 就在上周,它的工作就像一个魅力。

然而,今天,当我运行通常的cap deploy命令时,它尝试从我的Bitbucket Git存储库读取时,在第三步失败:

DEBUG [6906a62c] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.2.1"
  GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/app/git-ssh.sh" ; /usr/bin/env git
  ls-remote --heads git@bitbucket.org:klenwell/app.git )

这是错误:

DEBUG [6906a62c]       conq: repository access denied.
DEBUG [6906a62c]       fatal: The remote end hung up unexpectedly

我已经完成了明显的故障排除:谷歌搜索错误消息,确认VPS正常运行,验证存储库是否可访问,双重检查SSH密钥,确认SSH代理正在运行。 如果所有其他方法都失败了,我会尝试在我的VPS主机上生成一个新密钥。

这些要点尤其令我感到困惑:

  • (据我所知)自上次成功运行以来,没有对Capistrano或VPS配置进行任何更改。 上周我看到同样的命令在我的Capistrano日志中成功运行。
  • 当我作为部署用户ssh进入我的VPS服务器时,我可以手动运行ssh -T git@bitbucket.org和相同的git命令而不会出现问题。
  • 我本地计算机上的Jenkins服务器可以使用其部署密钥从同一个Bitbucket存储库成功读取。

我错过了什么?


I use Capistrano (v3.5.0) to deploy a small Rails application from my local development machine to a VPS hosted on Linode using a deployment key set up on Bitbucket. As late as last week, it was working like a charm.

Today, however, when I run the usual cap deploy command, it fails at the third step when it tried to read from my Bitbucket Git repository:

DEBUG [6906a62c] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.2.1"
  GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/app/git-ssh.sh" ; /usr/bin/env git
  ls-remote --heads git@bitbucket.org:klenwell/app.git )

This is the error:

DEBUG [6906a62c]       conq: repository access denied.
DEBUG [6906a62c]       fatal: The remote end hung up unexpectedly

I've done the obvious troubleshooting: googled the errors messages, confirmed the VPS is operational, verified the repository is accessible, double-checked the SSH keys, confirmed the SSH agent is running. If all else fails, I will try generating a new key on my VPS host.

These points in particular have me flummoxed:

  • There have been (as far as I can tell) no changes to the Capistrano or VPS configuration since it last ran successfully. I see the same command running successfully in my Capistrano logs last week.
  • When I ssh into my VPS server as the deploy user, I can run ssh -T git@bitbucket.org and the same exact git command manually without issue.
  • The Jenkins server on my local machine can successfully read from the same Bitbucket repository using its deployment key.

What am I missing?


原文:https://stackoverflow.com/questions/38186432
更新时间:2022-05-01 22:05

最满意答案

您可以使用JUnit的InOrder

DbCall dbCall = mock(DbCall.class);
List<Element> list = Arrays.asList(newElement(1), newElement(2), newElement(3));

runDeleteMethod(list);

InOrder inorder = inOrder(dbCall);
inorder.verify(dbCall).delete(1);
inorder.verify(dbCall).delete(2);
inorder.verify(dbCall).delete(3);

You can use JUnit's InOrder.

DbCall dbCall = mock(DbCall.class);
List<Element> list = Arrays.asList(newElement(1), newElement(2), newElement(3));

runDeleteMethod(list);

InOrder inorder = inOrder(dbCall);
inorder.verify(dbCall).delete(1);
inorder.verify(dbCall).delete(2);
inorder.verify(dbCall).delete(3);

相关问答

更多
  • 我发现的唯一解决方案就是通过工具测试(androidTest目录)使用JUnit。 我的类现在可以很好地测试,但在Android设备或模拟器的帮助下。 The only solution I found that works without hacks is to use JUnit through instrumentation testing (androidTest directory). My class can now be tested fine but with help of the and ...
  • 您可以创建一个TestSuite并在其中运行所有测试, if __name__ == '__main__'块: import unittest def create_suite(): test_suite = unittest.TestSuite() test_suite.addTest(fooTest()) test_suite.addTest(barTest()) return test_suite if __name__ == '__main__': s ...
  • 首先,通过大多数定义,“单元”测试不依赖于像数据库这样的外部系统。 你想创建所谓的“功能”或“集成”测试。 在实践中,这些类型的测试将像单元测试一样使用类似Junit的方式来实现,但是您应该将它们与单元测试分开,单元测试应该运行得非常快并且在数据库关闭或数据发生更改时不会中断。 其次,尽量将大部分业务逻辑保留在DAO之外,并将其放入服务POJO层,以便测试业务逻辑而不涉及数据库。 接下来,设置DAO测试的理想方法是从一个空数据库开始,并使用测试数据(通常使用DAO本身)加载测试数据,然后针对已知和可写的测试 ...
  • 您的代码很难阅读。 学习Java编码标准 。 你的方法不应该打印任何东西。 确定用户是否有效。 在别处打印消息。 我假设你有一个封装凭证的类用户: package misc.user; import org.apache.commons.lang3.StringUtils; /** * Created by Michael * Creation date 8/5/2017. * @link https://stackoverflow.com/questions/45524768/java-unit ...
  • 您可以使用JUnit的InOrder 。 DbCall dbCall = mock(DbCall.class); List list = Arrays.asList(newElement(1), newElement(2), newElement(3)); runDeleteMethod(list); InOrder inorder = inOrder(dbCall); inorder.verify(dbCall).delete(1); inorder.verify(dbCall).d ...
  • 从外观javax.comm , javax.comm API并不能让单元测试变得简单 - 它在类上很重要,而且在接口上很轻松。 我的建议是为你需要在驱动程序中使用的每个javax.comm类创建接口和适配器类。 然后,您的驱动程序代码将与这些接口进行通信,而不是直接与javax.comm进行javax.comm 。 您可能只需要API的一个子集,定义这些接口应该可以帮助您阐明您的设计。 这将允许您在单元测试中使用这些接口的模拟实现(例如JMock,Mockito等)。 您的单元测试可以将这些模拟注入到驱动程 ...
  • EclEmma是一个Eclipse插件,可以做到这一点。 EclEmma is an Eclipse plugin that does just that.
  • 将我的评论作为扩展答案发布。 首先,您需要将数据句柄函数提取到另一个模块中,例如data-handler.js (这是您的代码的一个示例,它可能会被增强以使其看起来更好,但它只是提供了一个想法) module.exports = { handler: (rowData, topCsvStream, otherCsvStream) => { if(headerRow.length === 0) { // Save header row in CSV's h ...
  • 这是Java依赖关系如何工作的结果。 运行JUnit测试时,src / test / java目录用作要运行的项目,src / main / java被视为依赖项。 当java尝试解析导入路径时,它不知道该路径是来自内部文件还是依赖项。 因此,它将首先尝试在项目中解决它,然后查看依赖项。 如果它在项目中找到匹配项,它将不会再看了。 同样,当运行'生产'代码时,src / main / java被用作主项目而不依赖于src / test / java,因此它将始终获得MyObject的原始实现。 以这种方式覆 ...
  • 你必须在这里明确责任。 一部分是实际的“服务”,它必须与该数据库通信,并且您希望通过SwingWorker运行。 我会完全独立于线程上下文来实现DBService 。 而且DBService类与SwingWorker 没有任何关系。 它是一个“独立”类,提供特定服务,可以完全单元测试,无需担心SwingWorker或线程。 然后你创建自己的小SwingWorker,它接受该DBService的一个实例并使用该对象来完成它的工作。 现在,您可以将一个模拟的DBService实例提供给您的SwingWorker ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)