1

I want to deploy my project to Heroku without placing my project to github? is this possible because I have to perform these steps and getting error. Here are the step i have performed

  1. In my project i run this command git init
  2. then i added some files git add myProjectFiles
  3. I create a project on Heroku through heroku create myprojectname
  4. Then i write this command to push my project on git push heroku master and i got this error:

error: src refspec master does not match any.

some refs to 'https:///git.heroku.com/tllwebsocekt.git'error: failed to push

  1. Then i tried this git push heroku fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use

    git push --set-upstream heroku master

  2. on this error i tried this git push --set-upstream heroku master but it also throw an error

error: src refspec master does not match any.

some refs to 'https:///git.heroku.com/tllwebsocekt.git'error: failed to push

Muhammad Faizan Khan
  • 10,013
  • 18
  • 97
  • 186
  • Don't confuse Git with GitHub. GitHub is a service for hosting Git repositories. Git is the version control tool. You do not need GitHub to use Git. – Graham Dumpleton Oct 24 '17 at 11:27
  • Possible duplicate of [src refspec master does not match any when pushing commits in git](https://stackoverflow.com/questions/4181861/src-refspec-master-does-not-match-any-when-pushing-commits-in-git) – phd Oct 24 '17 at 11:28

1 Answers1

0

Heroku will try build your app when you git push heroku master

In order for the app to be pushed successfully you'll need to git commit after git add myProjectFiles then specify the buildpack for you app:

heroku buildpacks:set heroku/python

After specifying the buildpack add a requirements.txt either blank or:

pip freeze > requirements.txt
git add requirements.txt
git commit

Next you'll need to specify what command heroku should run when you've pushed the app with a Procfile:

example Procfile:

worker: python main.py

Then:

git add Procfile
git commit

Finally heroku will be able to build your app and it won't reject the push:

git push heroku master

Alternatively if you have all the above in the myProjectFiles directory

Initialise git from inside your app directory:

cd myProjectFiles
git init
git add *
git commit
heroku create myprojectname
heroku buildpacks:set heroku/python
git push heroku master
foxyblue
  • 2,859
  • 2
  • 21
  • 29