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.
To see local branches, use the git branch command. The git branch command lets you see a list of all the branches stored in your local version of a repository. To see the remote branches associated with your repository, you need to append the -r flag to the end of the git branch command.
You need to use git pull and resolve the difference between your local changes and the remote changes before you can git push . There is still a commit in the remote branch initializing the repo that may not be in your local version.
If your current local branch is linked to a remote branch, then git status will tell you if your local branch is behind or ahead by any commits.
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.
Ha! Just found out that you actually need to have a git repo created before the
heroku apps:create app_name
call. Simply do
git init
git add .
git commit -m "Initial Commit."
and then do the app creation command.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With