Error when deploying discord.py bot to Heroku: pathspec 'rewrite' did not match any file(s) known to git

734    Asked by ankur_3579 in Devops , Asked on Jul 21, 2021

so when I'm trying to deploy my discord.py bot to Heroku, it shows following error when executing the last command: > error: pathspec 'rewrite' did not match any file(s) known to git I already searched everywhere, but I couldn't find any solutions. Following you will find my cmd commands + output. I really appreciate any help!

C:UsersRubenDesktoprubot-git>git init Initialized empty Git repository in C:/Users/Ruben/Desktop/rubot-git/.git/ C:UsersRubenDesktoprubot-git>heroku login heroku: Press any key to open up the browser to login or q to exit: Opening browser to [] Logging in... done Logged in as [] C:UsersRubenDesktoprubot-git>heroku apps:create rubot-host Creating ⬢ rubot-host... done https://rubot-host.herokuapp.com/ | https://git.heroku.com/rubot-host.git C:UsersRubenDesktoprubot-git>heroku buildpacks:set heroku/python Buildpack set. Next release on rubot-host will use heroku/python. Run git push heroku main to create a new release using this buildpack. C:UsersRubenDesktoprubot-git>heroku git:remote -a rubot-host set git remote heroku to https://git.heroku.com/rubot-host.git C:UsersRubenDesktoprubot-git>git add . warning: LF will be replaced by CRLF in bot.py. The file will have its original line endings in your working directory C:UsersRubenDesktoprubot-git>git commit -m "initial commit" [master (root-commit) e1eb173] initial commit 4 files changed, 32 insertions(+) create mode 100644 Procfile create mode 100644 bot.py create mode 100644 requirements.txt create mode 100644 runtime.txt.txt C:UsersRubenDesktoprubot-git>git push heroku master Enumerating objects: 6, done. Counting objects: 100% (6/6), done. Delta compression using up to 8 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 913 bytes | 304.00 KiB/s, done. Total 6 (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: -----> Python app detected remote: -----> Installing python-3.6.12 remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2 remote: -----> Installing SQLite3 remote: -----> Installing requirements with pip remote: Collecting git+https://github.com/Rapptz/discord.py@rewrite (from -r /tmp/build_36bc5831/requirements.txt (line 1)) remote: Cloning https://github.com/Rapptz/discord.py (to revision rewrite) to /tmp/pip-req-build-jxayyj_3 remote: Running command git clone -q https://github.com/Rapptz/discord.py /tmp/pip-req-build-jxayyj_3 remote: WARNING: Did not find branch or tag 'rewrite', assuming revision or ref. remote: Running command git checkout -q rewrite remote: error: pathspec 'rewrite' did not match any file(s) known to git remote: ERROR: Command errored out with exit status 1: git checkout -q rewrite Check the logs for full command output. remote: ! Push rejected, failed to compile Python app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to rubot-host. remote: To https://git.heroku.com/rubot-host.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/rubot-host.git'

Answered by Caroline Brown

It appears that your requirements.txt file is incorrect. It presumably has a line that looks like git+https://github.com/Rapptz/discord.py@rewrite

which references a Git branch that does not exist. The package name, with options that you may or may not want to install, is documented in its README. You should configure your requirements.txt accordingly to use a package name, not a Git URL.

What is discord.py rewrite? discord.py is a modern, easy to use, feature-rich, and async ready API wrapper for Discord which is easy to use with an object oriented design.



Your Answer

Interviews

Parent Categories