ruby - gem push 失败,控制台中的 HTML 输出
问题描述
我正在学习 Rails 课程,目前正在创建和发布一个 Ruby gem(名为kang_view_tool
)。我一直无法将其推送到RubyGems:
bundle exec rake release
gem push kang_view_tool-0.1.0.gem
两种方法都导致控制台上的以下输出:
$ gem push kang_view_tool-0.1.0.gem
Pushing gem to https://github.com/nahuakang/kang_view_tool...
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'">
<meta content="origin" name="referrer">
<title>Oh no · GitHub</title>
<meta name="viewport" content="width=device-width">
<style type="text/css" media="screen">
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
}
.container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; }
a { color: #4183c4; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { letter-spacing: -1px; line-height: 60px; font-size: 60px; font-weight: 100; margin: 0px; text-shadow: 0 1px 0 #fff; }
p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }
ul { list-style: none; margin: 25px 0; padding: 0; }
li { display: table-cell; font-weight: bold; width: 1%; }
.logo { display: inline-block; margin-top: 35px; }
.logo-img-2x { display: none; }
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and ( min--moz-device-pixel-ratio: 2),
only screen and ( -o-min-device-pixel-ratio: 2/1),
only screen and ( min-device-pixel-ratio: 2),
only screen and ( min-resolution: 192dpi),
only screen and ( min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
}
#suggestions {
margin-top: 35px;
color: #ccc;
}
#suggestions a {
color: #666666;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
}
</style>
</head>
<body>
<div class="container">
<h1>What‽</h1>
<p>Your browser did something unexpected. Please contact us if the problem persists.</p>
<div id="suggestions">
<a href="https://github.com/contact">Contact Support</a> —
<a href="https://githubstatus.com">GitHub Status</a> —
<a href="https://twitter.com/githubstatus">@githubstatus</a>
</div>
<a href="/" class="logo logo-img-1x">
<img width="32" height="32" title="" alt="" src="data:image/png;base64,...">
</a>
<a href="/" class="logo logo-img-2x">
<img width="32" height="32" title="" alt="" src="data:image/png;base64,...">
</a>
</div>
</body>
</html>
这个问题似乎与 Github 有关,但我不知道如何解决它,也没有在 Stackoverflow 上找到有帮助的答案。有没有人有任何提示?谢谢!
解决方案
原来是一个愚蠢的问题。我通读了 RubyGems.org 的文档:
RubyGems 2.2.0 和更新版本支持
allowed_push_host
元数据值以限制 gem 推送到单个主机。如果您要发布私有 gem,您应该设置此值以防止意外推送到 rubygems.org...
原来我天真地指定了这个元数据值:
spec.metadata["allowed_push_host"] = "https://github.com/nahuakang/kang_view_tool"
.
我将其注释掉,然后运行:
$ gem build kang_view_tool
Successfully built RubyGem
Name: kang_view_tool
Version: 0.1.0
File: kang_view_tool-0.1.0.gem
$ gem push kang_view_tool-0.1.0.gem
Pushing gem to https://rubygems.org...
Successfully registered gem: kang_view_tool (0.1.0)
然后它起作用了。
推荐阅读
- python - PyQt5:QScrollArea 保持 Pixmap 纵横比
- csv - 从 excel 或 openrefine 中的唯一值列表中复制过去的标签到数据集
- java - Java 静态方法和 Kotlin 伴随对象有什么区别?为什么它在 Andorid 数据绑定中给出错误?
- php - 如何在不更改页面的情况下使用渲染网页进行重定向
- python - 如何加载和测试特定的 TensorFlow 保存模型?
- unix - 使用 Informatica 会话后命令替换参数文件中的日期值
- mockito - 无法使用 Mockito 模拟方法调用
- r - 转移概率表示
- c++ - 为什么 Windows 服务无法访问运行对象表
- android - 如何编写跨度从 EditText 到 .txt 的文本?