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:\Users\Ruben\Desktop\rubot-git>git init
Initialized empty Git repository in C:/Users/Ruben/Desktop/rubot-git/.git/

C:\Users\Ruben\Desktop\rubot-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:\Users\Ruben\Desktop\rubot-git>heroku apps:create rubot-host
Creating ⬢ rubot-host... done
https://rubot-host.herokuapp.com/ | https://git.heroku.com/rubot-host.git

C:\Users\Ruben\Desktop\rubot-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:\Users\Ruben\Desktop\rubot-git>heroku git:remote -a rubot-host
set git remote heroku to https://git.heroku.com/rubot-host.git

C:\Users\Ruben\Desktop\rubot-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:\Users\Ruben\Desktop\rubot-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:\Users\Ruben\Desktop\rubot-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: -----> 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:  !     Push failed
remote: Verifying deploy...
remote: !       Push rejected to rubot-host.
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'

1 Answer 1


It appears that your requirements.txt file is incorrect. It presumably has a line that looks like


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.