Heroku Deployment from multiple win7 64 machines - ruby-on-rails

First of all, I read this question but I still have problems with deploying from multiple machines.
From work everything works like a charm, but from home-machine I have problem pushing to same Heroku app. Both machines are Win7 64, IDE is Rubymine (jumping between integrated git gui and terminal - but no problems with that), Ruby200 and devkit both 32 and 64 (but on separate machines), .ssh keys in C:/users/.ssh/ (on both machines). Git stuff is also working like a charm on both machines. Same heroku acc.
On home machine when I $ heroku keys it lists 2 keys like it should (for work and home machine). Then when I $ git remote add heroku git#heroku.com:my-app.git I get fatal saying that I already have that remote repository on this machine. I check for remotes $ git remote -v and it lists 2 reps (both github and heroku), like it should, but when I $ git push heroku I get:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I tried deleting keys, generating new ones both with ssh-keygen -t rsa and heroku keys:add to create after previously removing one and with no luck. Even added it with heroku keys:add C:/path-to-ssh.pub if that specificity even mater.
I know that I can 'cheat' this out with DropBox but I'd rather avoid them and go this way, pulling from Github. Thank you in advance, if more info is needed I will provide it.
Edit: I tried $ heroku create project-with-another-name to create heroku app with same code and it goes through. After I check for that remote via $ git remote -v I don't see it (only old ones), but when I tried to add it with $ git remote add heroku ..., it said to me that remote allready exist and I can see it in Heroku dashboard. $ git push heroku master gives me same error as before.

The problem seems to be an issue with the local git repos on your system, and how they communicate with the remote Heroku repo.
The issue will either be with the ssh keys on your system, or the remote repos your computer will have (and how you're able to communicate with Heroku properly).
--
Fix
After looking at this question, you may wish to use the following:
Really all I had to do was follow these steps:
https://devcenter.heroku.com/articles/keys
First you have to create a key:
ssh-keygen -t rsa
Second you have to add the key to Heroku:
heroku keys:add
--
If that doesn't work, I would get rid of the local git repo & then create a new remote one for use with Heroku:
delete the .git repo for your local app
In the parent / apps directory, run git init [folder_name]
Inside the app folder directly, you can then run git#heroku.com:project.git

Solution:
# Generate key
ssh-keygen -t rsa
# Start of ssh-agent (I missed this step and
# it didn't added key to my machine even though it
# created file. In order to do: ssh-add C:/path/to/id_rsa_key
# I needed to start ssh-agent)
eval $(ssh-agent)
# Then add private key
ssh-add C:/path/to/id_rsa_key
cd C:/project
# And finaly send public key to heroku
heroku keys:add C:/path/to/id_rsa_key.pub

Related

Can't access my Heroku repo even though I've added my key

I'm trying to clone a current project from Heroku. I was having permission access issues so I removed existing keys, and added my current key:
$ heroku keys:add
Found an SSH public key at /home/martyn/.ssh/id_rsa.pub
Would you like to upload it to Heroku? [Yn] Y
Uploading SSH public key /home/martyn/.ssh/id_rsa.pub... done
$ heroku keys
=== martynbissett#yahoo.co.uk Keys
ssh-rsa AAAAB3NzaC...5VRkk6UVBT martyn#martyn-Lenovo-B590
$ heroku git:clone -a young-lowlands-8336
Cloning from app 'young-lowlands-8336'...
Cloning into 'young-lowlands-8336'...
Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I've check the site is live, and it is. From my Heroku control panel I can see that this project is active too. Why am I still being denied?
This is the response I got back from Heroku, and it seems to work now:
It looks like your local SSH is using a different key than the default one.
Could you try resetting your keys identities to the default with the following command:
ssh-add -D

Can a Rails app be deployed without using Heroku Toolbelt? If so, how?

I want to deploy rails app without using Heroku ToolBelt. Is it possible? If so, how? I'm only allowed to use Heroku dashboard; I'm not allowed to use any other cloud service :(
I have to run PostgreSQL commands, adding add-ons and setting configuration variables and possibly other tasks for which we have Heroku Toolbelt to deploy a application in production environment.
Error:
user#xx ~/Desktop/github/blog (master)
$ git push git#heroku.com:herokugui.git master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I don't want to use Heroku Toolbelt. That's why I am using Git commands to deploy code on Heroku. I am not able to push code to Heroku using Git commands. Is it possible to do this task without the toolbelt?
Another question I have is: is there any way to run PostgreSQL commands on Heroku GUI? If so, how?
It's not easy (as with Heroku toolbelt), but it's possible. It involves hanging around your Heroku dashboard at least, so make sure you can access it.
First off, you need a key. If you're on a Linux machine (as me), then in your home directory you should have a folder named .ssh (it may be hidden, hit Ctrl+H to reveal, again, if Linux) and a file id_rsa.pub in there. If not, you need to generate your SSH key first.
ssh-keygen -t rsa
That will prompt you for a folder, default is fine, just hit Enter, then enter the passphrase (twice) to protect your key from being accessed by anyone else on your computer: without a passphrase it's unencrypted and free for anyone to take and use from that machine.
Once that is done, locate your public key file: id_rsa.pub. Note: not id_rsa, it's a private key, you may not want to give it to anyone, it's much like your future Heroku password, except for it's insanely large for a password. Open id_rsa.pub, you should see stuff like:
ssh-rsa aWhOLELotofUnreadABLEGibbERishWHiCHiSactUALLyYourPubLIcKeY...
You need to enter that line into your account settings in Heroku dashboard, under SSH Keys. You can find more info on keys here, in Heroku docs. Make sure Heroku actually recognizes you by issuing this:
ssh -v git#heroku.com
It should state you're authenticated.
Now for the git address. I assume you know your way around git, so I'll keep it short: you'll need to derive your repository address from your app name. Heroku usually generates weird (yet somewhat poetic) names like falling-wind-1624 or shielded-fjord-1858. I'll take the first one as an example, this is how you add its address as a git remote:
git remote add heroku git#heroku.com:falling-wind-1624.git
I'll explain a bit of it below. So what the toolbelt does here, is to use your app name only, it just builds the URL the same way by adding a path to Heroku server. Once that's done, you should be able to push your code:
git push heroku master
I've named a Heroku remote heroku, above, that's why I'm using heroku name here, you can name it whatever you want and use this afterwards. Once you've pushed the code, the rest is up to you.

How to access Heroku from command line if directory has been deleted

A little while ago the files on my Macbook Pro were deleted by Apple, including a directory from which I used to access Heroku and be able to do command line operations in the Ruby/Rails console. Now that the directory is gone, I'm not sure if it's possible to access this repository from the command line, which I need to do to reduce the size of my database to stay within Heroku limits.
Update
before the directory was deleted on my mac, I used to simply cd into that directory and then run something like bundle exec heroku run console or heroku run bundle exec console, anyways if I did it from that directory heroku knew which application i was trying to access and it would take me into the rails console for it (where I could manipulate data)
Install the Heroku toolbelt (it's unclear whether you still have that)
From the terminal, perform a heroku login to authenticate
From a directory where you want the new app to live, run heroku git:clone APP-NAME
You'll now have a directory, which will have the latest files you pushed to Heroku - which will allow you to do things like git push heroku master, or heroku run rails console.
You probably want to then also attach your git repo where you are storing your source code with something like git remote add origin git#github.com:whoyouare/app-name.git
From the Heroku docs:
You can also take an existing Git repo and add a remote using the git URL provided when you created your app. You may need to do this to associate a Git repo with an existing application. The heroku git:remote command will add this remote for you based on your applications git url.
$ heroku git:remote -a falling-wind-1624
This will add your Heroku repo with the remote name of heroku to your working directory.

Heroku Create: Could not read from remote repository

Trying to deploy my first Rails app to Heroku.
All app code is here:
https://github.com/donpinkus/first_app.
Running heroku create gives me this error:
donaldmbp15:first_app donald$ git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.132' to the list of known hosts.
Connection closed by 50.19.85.132
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
donaldmbp15:first_app donald$
It sounds like something along the line, either Heroku or Github does not have access rights. I've pushed to Github from my local git repo, so I'm ruling out Github as the source of error. That leaves Heroku, or my local machine. Any ideas?
First Generate the RSA key first by following
bash: ssh-keygen -t rsa
Add your key to heroku
bash: heroku keys:add
Read more https://devcenter.heroku.com/articles/keys

Error while deploying application in heroku

I am getting below error while creating app and deploying in heroku using below command
sudo git push heroku master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I tried all the possible scenarios
creating new ssh key , giving admin rights to folder, deleting git remote for heroku and adding it again etc
Steps followed by me:
1) git init
2) git add .
3) git commit -m "Initial Commit"
4) heroku login
5) heroku create
6) sudo git push heroku master
Usually when we create new heroku project using "heroku create" it will create new project and that heroku URL is set as heroku GIT remote URL, but that also not happening everytime i am doing it manually. May be this also due to that same issue i guess...
Below is my detailed error
ponvino#ponvino-desktop:~/RubyWorkspace/prod/theScholarsPage$ sudo mv ~/.ssh/ /.ssh_backup
ponvino#ponvino-desktop:~/RubyWorkspace/prod/theScholarsPage$ heroku keys:add
Could not find an existing public key.
Would you like to generate one? [Yn] y
Generating new SSH public key.
Uploading SSH public key /home/ponvino/.ssh/id_rsa.pub... done
ponvino#ponvino-desktop:~/RubyWorkspace/prod/theScholarsPage$ git push heroku master
The authenticity of host 'heroku.com (50.19.85.156)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,50.19.85.156' (RSA) to the list of known hosts.
Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Please help me
Thanks in Advance,
Check that your ssh key is loaded:
ssh-add -l
If not:
ssh-add ~/.ssh/your_private_key
Try again to push to heroku
You should generate pair of keys and add your public key to your heroku account.
More info: https://devcenter.heroku.com/articles/keys
ssh-keygen -t rsa
and then:
heroku keys:add
should be enough.
If nothing works even after trying the above solutions. do this
$ mv ~/.ssh/ ~/.ssh_backup
$ heroku keys:add
$ git push heroku master
Almost same problem was asked and answered in the link below.
Try it

Resources