简体   繁体   English

git push heroku master 因“HTTP 400 curl 22 请求的 URL 返回错误”而失败

[英]git push heroku master fails by "HTTP 400 curl 22 The requested URL returned error"

I'm trying to push rails application that shows just "hello, world.".我正在尝试推送仅显示“你好,世界。”的 Rails 应用程序。
Then I met an error like below.然后我遇到了如下错误。
I would like to know how to solve this problem.我想知道如何解决这个问题。

$git push heroku master $git push heroku master
Enumerating objects: 88, done.枚举对象:88,完成。
Counting objects: 100% (88/88), done.计数对象:100% (88/88),完成。
Delta compression using up to 4 threads. Delta 压缩最多使用 4 个线程。
Compressing objects: 100% (73/73), done.压缩对象:100% (73/73),完成。
Writing objects: 100% (88/88), 22.29 KiB |写入对象:100% (88/88), 22.29 KiB | 1.71 MiB/s, done. 1.71 MiB/s,完成。
Total 88 (delta 2), reused 0 (delta 0)总计 88 个(增量 2),重复使用 0 个(增量 0)
error: RPC failed;错误:RPC 失败; HTTP 400 curl 22 The requested URL returned error: 400 Bad Request HTTP 400 curl 22 请求的 URL 返回错误:400 Bad Request
fatal: The remote end hung up unexpectedly致命:远端意外挂断
Everything up-to-date一切都是最新的

My procedures are below.我的程序如下。
1.create rails application like below. 1.创建如下所示的rails应用程序。
rails new sample
2.fix routes and application_controller to show hello, world. 2.修复路由和application_controller以显示hello,world。 3.change Gemfile. 3.更改Gemfile。
3-1.declare sqlite3 in development and test group gem 'sqlite3' 3-1. 在开发和测试组gem 'sqlite3'
3-2.declare pg in production group gem 'pg', '0.20.0' 3-2. 在生产组gem 'pg', '0.20.0'
4.execute bundle install --without production 4.execute bundle install --without production
5.execute git add . 5.执行git add .
6.execute git commit -m "initial commit for heroku" 6.execute git commit -m "initial commit for heroku"
7.confirm if it works by rails s and access to localhost:3000 7.通过rails s确认它是否工作并访问localhost:3000
8.execute heroku login and enter id and password. 8.执行heroku login并输入id和密码。
9.execute heroku keys:add and the SSH key is created by this operation. 9.execute heroku keys:add并且通过此操作创建SSH密钥。
10.execute heroku create 10.执行heroku create
11.execute git push heroku master and then I got the error 11.execute git push heroku master然后我得到了错误

Each programs' version is below.每个程序的版本如下。
* Rails 5.1.6 * 导轨 5.1.6
* heroku/7.14.1 win32-x64 node-v10.9.0 * heroku/7.14.1 win32-x64 node-v10.9.0

What is this error and how can I avoid this error?这是什么错误,如何避免此错误?
Please tell me if you need more information.如果您需要更多信息,请告诉我。


I added my gem file below.我在下面添加了我的 gem 文件。

source 'https://rubygems.org'

# git_source(:github) do |repo_name|
#  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
#  "https://github.com/#{repo_name}.git"
# end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.6'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'rails_12factor'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

group :production do
  gem 'pg', '0.20.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

导航到存储库后,运行以下命令将缓冲区增加到 500MB:

git config http.postBuffer 524288000

In case it helps anyone, I had this exact same error pushing to Azure.如果它可以帮助任何人,我在推送到 Azure 时遇到了完全相同的错误。 It turned out I'd filled my App Service storage quota.结果我已经填满了我的应用服务存储配额。 I deleted a bunch of big files and the problem was solved.我删除了一堆大文件,问题解决了。

In my case, I had to both change the remote URL to use the git: protocol instead of https: , and I also had to create a public key.就我而言,我必须更改远程 URL 以使用git:协议而不是https: ,而且我还必须创建一个公钥。

To get the current URL:要获取当前 URL:

git remote get-url heroku

Supposing your URL is something like https://git.heroku.com/your-repo-here.git , you should use this command to use the git: protocol:假设你的 URL 类似于https://git.heroku.com/your-repo-here.git ,你应该使用这个命令来使用git:协议:

git remote set-url heroku git@heroku.com:your-repo-here.git

Create public key:创建公钥:

heroku keys:add

Reference links:参考链接:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM