git push heroku master fails in heroku - windows

I am starting out with heroku and am following the getting to start with heroku tutorial. I am on windows 7 and am using Windows powershell as the command line.
The commands that I am using are
git clone git://github.com/heroku/ruby-sample.git
cd ruby-sample
heroku login
heroku create
git push heroku master
heroku open
The directory was cloned and after heroku login I got Authentication successful. in the command line. After heroku create I got
Creating immense-lowlands-8694... done, stack is cedar
http://immense-lowlands-8694.herokuapp.com/ | git#heroku.com:immense-lowlands-8694.git
Git remote heroku added
so the app was added to my heroku account. But there was problem with git push heroku master. I got
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What I have tried so far
This question said about adding keys but it is for Linux and didn't work for Windows 7.
I used heroku keys and it says that there is a key present for my e-mail ID.
As this answer says I tried heroku keys:add and got
this
Found existing public key: C:/Users/Aseem/.ssh/github_rsa.pub
Uploading SSH public key C:/Users/Aseem/.ssh/github_rsa.pub... done
but after that the error didn't end.
I tried what this answer says but ssh-keygen wasn't recognized so I guess it's for linux.
I tried removing using heroku keys:remove KEY_NAME and then heroku login to login again but that didn't take care of the error either.
What can I do to solve the problem?

Installed MSysGit instead of git. Added the C:\Program Files(x86)\Git\bin directory to the PATH variable and then doing what this answer says solved the problem.

Related

"Couldn't find that app." when running heroku commands in console

I'm trying to run commands for my heroku app in my console, but it keeps telling me "Couldn't find that app." even though when I run heroku apps in my console it tells me I have one app called worldofwarcraft-api
So heroku recognizes my app in the apps list, but I can't run any commands to access it. The line I want to run is
heroku ps:scale web=1 --app worldofwarcraft-api
I'm trying to troubleshoot why my API returns a 503 when I try to make a GET request to it. This is the fix the heroku faq told me to try, but it's just telling me it can't find my app.
I'm wondering if it has something to do with the fact that I deployed my API from github, rather than running the heroku setup in my console. I don't know if that would effect my ability to run heroku commands on the app in my local console.
Apologies if my formatting is off a bit. I'm still getting used to this site.
In my case, someone renamed GitHub repo and I tried to find Heroku app with new GitHub name
It helps me
heroku apps
heroku git:remote -a YOUR_APP
Solved it. Just sharing for future searches.
The issue was fixed by running git init and then heroku git:remote -a worldofwarcraft-api in my command line while inside my repositories folder. This initialized git in the repo and then set the heroku git remote to that repository.
Hopefully, this helps anyone else who had a similar issue.
Just an easy way to solve this issue:
1st: Add the command into your terminal: $ heroku apps
If you already logged into your heroku account from your terminal, all your apps will appear as a list like this:
your-project-name-1
your-project-name-2
your-project-name-3
your-project-name-4
2nd: Then chose which one you are needing to connect with the following command:
$ heroku git:remote -a your-project-name-2
If you've done the connection properly you'll receive the following output:
set git remote heroku to https://git.heroku.com/your-project-name-2.git
For my case, I was renaming my github repository.
You can find it in your repository settings then just rename it, it appears in the first place.
Then you can continue with git init again to re-initiate your existing git repository and then set your heroku remote with your heroku apps new name heroku git:remote -a YOUR_APP_NAME
If the app belongs to a team that you participate in, you have to specify the team option in the commands to see the app:
E.g:
heroku apps -t <team name>
or
heroku ps:scale web=1 --app worldofwarcraft-api -t <team name>

Failed to deploy application to heroku

I am newbie into heroku. I was trying to deploy a Django application to heroku by following steps.
Installed vartualenv
Installed Django gunicron via pip
Installed heroku toolbelt
Created an empty git
git add .
git commit -m "First commit"
ssh-keygen
heroku create
heroku keys:add
git push heroku master
And the a error
(venv)han#HEEL:~/Desktop/projects/ossko$ heroku keys:add
Found existing public key: /home/han/.ssh/id_rsa.pub
Uploading SSH public key /home/han/.ssh/id_rsa.pub... done
(venv)han#HEEL:~/Desktop/projects/ossko$ git push heroku master
ssh: connect to host heroku.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have follow every steps from heroku help site.
Please help me to fix this error
I have Ubuntu 13.4 64bit os
Update: here is the result of git remote -v:
$git remote -v
heroku git#heroku.com:infinite-mesa-xxx.git (fetch)
heroku git#heroku.com:infinite-mesa-xxx.git (push)
Try running git remote -v. Does it give you more than one remote, like this?
your_app_name git#heroku.com:your_app_name.git (fetch)
your_app_name git#heroku.com:your_app_name.git (push)
If the remote depot is named something other than 'heroku' you will need to specify the push to that site instead. For example, if your remote is named ossko, try something like
git push ossko master
Often you will have different names for remote depots if you have more than one heroku app - you can use a different name for each app.
Ok, i just solved the problem, This problem is with adding ssh key.
So the correct commands for heroku deploying is
nihan#heel:~$ heroku login
Enter your Heroku credentials.
Email: debashis.dip#gmail.com
Password (typing will be hidden):
Authentication successful.
nihan#heel:~$ cd dev/flask-app
nihan#heel:~/dev/flask-app$ heroku keys:clear
Removing all SSH keys... done
nihan#heel:~/dev/flask-app$ heroku keys:add
Found existing public key: /home/nihan/.ssh/id_rsa.pub
Uploading SSH public key /home/nihan/.ssh/id_rsa.pub... done
nihan#heel:~/dev/flask-app$ ssh-add ~/.ssh/id_rsa <---- This was the missing key
Enter passphrase for /home/nihan/.ssh/id_rsa:
Identity added: /home/nihan/.ssh/id_rsa (/home/nihan/.ssh/id_rsa)
nihan#heel:~/dev/flask-app$ git push heroku master
Because my ssh never knew which key to use it somehow have heroku the wrong information and that's why heroku was denying.

Error trying to push a project into Heroku

Environment: Windows 7
I go to Start | Run and type cmd.
I changed to my directory on my local hard drive and I was able to successfully clone the Github project:
git clone git://github.com/heroku/ruby-sample.git
I then change to the directory:
cd ruby-sample
I'm able to run the Heroku create:
heroku create
I log into Heroku via Firefox and I can see my App directory on Heroku. So far, so good. Then I try and push:
git push heroku master
and every time I get the same error:
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
I've Googgled and looked at a number of similar questions; but unfortunately, I'll be the first to admin that Linux is a very weak area for me. I haven't found an answer that is specific to this setup on a Windows 7 environment. I do have the Heroku Toolbelt installed.
Thank you!
V
(I realized I assumed Rails here and you did not specify that. If you aren't using Rails, ignore the comment about RailsInstaller and RailsBridge.)
You may need to add your ssh key to your heroku setup with:
heroku keys:add
If you used RailsInstaller, that should just work. If not, and you don't have an ssh key pair, you'll need to look up how to do that first. You can use PuTTY to do that: http://kb.site5.com/shell-access-ssh/how-to-generate-ssh-keys-and-connect-to-your-account-with-putty/
For a full procedure that will get an app bootstrapped onto Heroku with a Rails app, see: http://installfest.railsbridge.org/installfest/installfest

git push heroku master Permission denied (publickey)

Edit #3
Updating this at the top because it solved my issue and gave me a good troubleshooting step I didn't know about (and could save you some time, too)
Try getting the output of ssh -vvv git#heroku.com. For me, ssh was getting hung up on trying keys in /c/Program Files (x86)/Emacs/.ssh when my public key was in /c/Users/NumberOverZero/.ssh
Deleting the Emacs ssh folder (which was empty) fixed my issue since ssh would then check my Users .ssh folder.
I'm getting Permission denied (publickey) when trying to git push heroku master.
A few things that makes this different from the posts below:
I have ssh working for github
I was able to successfully push to heroku last night
Since that push, I've made a single-line change to one js file, and committed and pushed. There have been no other changes.
The closest I could find was this post:
git clone heroku ssh permission denied
I've looked through the related issues (there's quite a few):
git push heroku master Permission denied (publickey). fatal: The remote end hung up unexpectedly
git push heroku master permission denied
git clone heroku ssh permission denied
https://stackoverflow.com/questions/13059076/git-push-permission-denied-publickey-windows-xp
heroku - rails - Permission denied (publickey)
I've tried:
heroku keys:clear
heroku keys:add
heroku keys:clear
*delete every key in .ssh*
heroku keys:add
*delete my application on heroku*
heroku keys:clear
heroku login (adds key for me)
heroku create
git push heroku master
fails
*delete the app on heroku*
delete keys in .ssh
heroku keys:clear
copy all files into a new repository
push new repository to github successfully
heroku login (adds github key for me)
heroku create
git push heroku master
fails
*delete the app on heroku*
heroku keys:clear
heroku login (adds key for me)
heroku create
heroku git:clone app app
fails
Any ideas? I've gone through all of the steps in the linked SOs - most of which were just people not running heroku:add or setting up ssh keys (which I've done in each of these).
I let heroku take the wheel most of the time, (instead of directly creating ssh keys) assuming that the built-in commands would do what they needed when there were no ssh keys present. It seems not.
EDIT: And now that I deleted the app, the new relic addon is alarming that the website is down. Trying to log in through their website asks me to log in through heroku. Which I can't find a way to do, since the app is gone. Is there a way to delete that addon now that I can't get to the app? heroku addons gives an error, so I don't think I'm getting to it through there.
EDIT #2: Added another step I tried - moved files into new repository and push to new application.
I had the same problem for Windows 7 box and found the solution here: http://www.gmarwaha.com/blog/2011/05/18/heroku-trouble-with-windows-and-ssh-keys/
Solution: Typically once you create the keys as mentioned above, two files – “id_rsa” and “id_rsa.pub” – are stored in the “.ssh” folder
within the user’s home folder. If you are working with linux that
seems to be good enough. But for the windows version of git that
doesn’t seem to cut it. It wants the keys to be stored inside the
“.ssh” folder within the “msysgit” installation folder as well. If you
don’t find a “.ssh” folder inside the “msysgit” installation folder,
feel free to create one. Once you drop these two key files there and
repeat the entire process, everything went as smooth and my
application got deployed in the heroku cloud and the world is again a
better place to live in.
In my case, I have to find where git.exe was installed, which is C:\Program Files\Git\. So here are the steps:
Create .ssh folder inside C:\Program Files\Git\
Copy id_rsa and id_rsa.pub from your home folder (C:\Users\username\.ssh\) to C:\Program Files\Git\.ssh\.
Try again with C:\dev\heroku\sample-app> git push heroku master.
Nice job linking to all the other things you've looked at and tried! (that will improve the responses you get, but still you should be prepared for a lot of 'have you tried...', and 'maybe it's ...' because this is a system/env issue that isn't on the normal flow)
You might have had something working in your local terminal session that has since been lost. (I've had this happen a bunch of times)
Things it might be:
your ssh keys on heroku
your ability to push up to heroku from that computer/network
something about your git repo
I ran into this once and it was driving me crazy. I hopped on my (FREE) cloud9 account, cloned some simple rails app from github and pushed it out to heroku, which helped me prove that my heroku account was fine, heroku itself was fine, but my local laptop had some issues in my configuration.
I think the issue was my username, but I don't remember. (moving to a different env and starting from scratch helped me realize the issue though)
The main reason you get this message is because you do not have ssh-keygen added to your environment variables.
This command is located in the bin-directory of Git program files.
You should add that bin directory to your environment variables.

How to attach my repo to heroku app

I create a heroku app and then my machine crashed. I have a new machine. How do I attach my existing app to heroku app. When I visit heroku page the url for my app is like this
git#heroku.com:myapp.git
I can't do clone this app because I already have myapp from github. So I need to add heroku as remote to my existing github app. Anyone knows the syntax.
If you've heroku toolbelt:
If you're using the Heroku Toolbelt, the newer syntax is
heroku git:remote -a project
See this for more.
Credits: user101289's solution
Else if you don't have heroku toolbelt:
First do this:
git remote add heroku git#heroku.com:{heroku-app-name}.git
Then do this:
git push heroku master
heroku open
If you're using the Heroku Toolbelt, the newer syntax is
heroku git:remote -a project
See this for more.
If you're using just Git without installing the Heroku Toolbelt, you can also create a new application.
Login to your account and go to this link
https://dashboard.heroku.com/apps
Look at the plus sign on the top right corner then select
Create new app
Leave the application name blank to let heroku choose one for you.
Let say your heroku app name is new-app-xxxxx, so to test on adding a file in to it you may try the following command:
git clone https://git.heroku.com/<new-app-xxxxx>.git
cd <new-app-xxxxx>
echo "my test file" > test.txt
git add .
git commit . -m "my test on commit"
git push
Put empty (blank) when the Git prompt for username, and your API Key for the password. You can get your API Key by showing it from the link below.
https://dashboard.heroku.com/account
Note: You cannot authenticate with the Heroku HTTP Git endpoint using your Heroku username (email) and password. Use an API key as described here.

Resources