0
0

More than 3 years have passed since last update.

herokuへのデプロイでfailed to push some refs to …のエラー

Posted at

環境

PHP : 7.1.3
Laravel : 5.7
docker-compose.yml

#docker-compose.ymlのバージョン
version: '3'
#docker volumeの設定
volumes:
  docker-volume:

#services以下に各コンテナの設定を書く
services:
  #Webサーバーのコンテナ
  web:
    image: nginx:1.18
    ports:
    - '8000:80'
    volumes:
    - ./server:/var/www
    - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
    - php

  #アプリケーションのコンテナ
  php:
    build: ./docker/php
    volumes:
    - ./server:/var/www

  #データベースのコンテナ
  db:
    image: mysql:5.7
    ports:
    - '13306:3306'
    environment:
      MYSQL_DATABASE: laravel
      MYSQL_USER: root
      MYSQL_ROOT_PASSWORD: password
      TZ: 'Asia/Tokyo'
    volumes:
    - docker-volume:/var/lib/mysql

エラー内容

xxx@MacBook-Pro ponshuki % git push heroku master
Enumerating objects: 1653, done.
Counting objects: 100% (1653/1653), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1600/1600), done.
Writing objects: 100% (1653/1653), 6.16 MiB | 2.15 MiB/s, done.
Total 1653 (delta 1033), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote:  !     No default language could be detected for this app.
remote:             HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:             See https://devcenter.heroku.com/articles/buildpacks
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to rocky-ravine-27668.
remote: 
To https://git.heroku.com/rocky-ravine-27668.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/rocky-ravine-27668.git'
xxx@MacBook-Pro ponshuki %  git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   server/.env.example

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    Procfile

no changes added to commit (use "git add" and/or "git commit -a")

原因

ディレクトリ構造が問題だった
dockerを使用していたため、直下のデイレクトリにcomposer.jsonがなくてはいけない。

phpをherokuが認識できない

解決方法

git subtree push --prefix server/ heroku master

できたー!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0