tentekoten
@tentekoten

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Herokuにpythonファイルをデプロイすると ! [remote rejected] master -> master (pre-receive hook declined)となる

解決したいこと

LineMessagingAPIの実装のためHerokuでpythonをデプロイしようとしたのですが以下のようなエラーが発生してしまいpushできませんでした。

発生している問題・エラー

Enumerating objects: 15, done.
Counting objects: 100% (15/15), done.
Delta compression using up to 8 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (15/15), 2.46 KiB | 630.00 KiB/s, done.
Total 15 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/gradle
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/gradle.tgz
remote:        Could not find a 'gradlew' script or a 'build.gradle' file! Please check that they exist and are commited to Git.
remote: 
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !	Push rejected to [appname].
remote: 
To https://git.heroku.com/[appname].git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/[appname].git'

エラー内容

 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/[appname].git'

自分で試したこと

隠しフォルダの.gitも存在し、

git add .
git commit -am "make it better"

をした上でpushしてみても変わりませんでした。

git remote -v

でremoteを確認してみてもしっかりherokuのappのURLが設定されていました。
branchname:mainだと分かり、ローカルのblanchnameはmasterのため、

git push heroku master:main

を試しても結果は同じでした。
何かエラー改善方法を知っている方がいたら教えて頂きたいです。
宜しくお願いします。

0

1Answer

Comments

  1. @tentekoten

    Questioner

    ありがとうございます!無事デプロイできました!

Your answer might help someone💌