tags:

views:

49

answers:

2

I'm following along with the railstutorial.org, and when I get to the "git push heroku master" part, I get the following error:

fatal: Not a git repository (or any of the parent directories): .git

So I do some googling, and see a common troubleshooting trick is to try "git remote -v". The problem is, whenever I try that, I get the same error as above. It seems no matter what I type after "git remote" will result in that error.

What am I doing wrong here?! I was cruising along so well until I hit this brick wall.

A: 

Looks as though you don't have your app setup as a heroku project. Here's some snippets from their docs.

sudo gem install heroku
heroku create some_project_name

Once this is done you should be able to push to heroku with "git push heroku master".

You can also check your git configuration by typing "cat .git/config" to see exactly what is setup. If you don't have that file then your project is not currently a git repository at all.

quest
+2  A: 

You need to actually create the git repo. Simply calling 'heroku create' won't set one up for you. For an existing folder, you want enter it and run something like:

git init
git add .
git commit -m 'Initial commit'

...and then you add the remote (fill in your heroku git repo name from heroku info here):

git remote add heroku [email protected]:sushi.git

If you're starting a fresh app and a git repo already exists in the current dir, heroku create will add the git remote for you, and you don't need to run that last command.

mkdir new-app
cd new-app
git init
heroku create

After that, create your app from that dir rails new . and run the git add and commit steps from above. Modify your app as desired, update git again with any changes, then git push heroku master to deploy.

Run more .git/config from the app's root dir to see the config file with all of your app specific git settings. This will list your remote repos.

Joost Schuur