Heroku: could not read from remote repository - heroku

I created an app and got on Heroku, everything worked fine until I had to format the computer.
I had to update the app and I can not synchronize the folders.
I Heroku Keys and saw that it appeared the network name before formatting, so I removed with heroku Keys: remove ... and added a new key with ssh-keygen-t rsa.
I also entered the git file and delete the lines in "heroku remote", but neither worked. After much testing I realized that in the same file in the fetch line did not appear the name of the app, instead put heroku, I changed it, but still not working.
I always show the same errors, although I already created a SSH public key: public key C :/ / .ssh / id-rsa.pub
permission denied (publickey)
fatal: Could not read from remote repository
Please make sure You have the correct access rights and the repository exists
Even I created a new app, but appear the same mistakes, it is clear that the problem is due to formatting the computer, something does not match and does not let me sync files in any app.

It sounds like Heroku is missing your SSH public key, you just need to add it using this command:
$ heroku keys:add
If you need to generate new SSH keys too, this article covers both of these topics.

Related

Multiple accounts heroku keys mixed up

I have multiple accounts on heroku and I think my ssh keys got messed up but I have no idea how to fix it.
When i try 'git push heroku master' i get the error 'your account ***** does not have access to *****'
How do I fix my keys so that I can push to heroku?
Heroku wont allow to share ssh key between 2 heroku accounts.
I will help you to get through this by a hacky fix
1.First go to .ssh/ directory in your home folder
2.Move all the files and keep it in any other folder(Don't delete it)
3.Open the terminal and Login to heroku using "heroku login" command and login to your heroku account which you want to push now.
4.After sucessfully logging in to your account enter "heroku keys:add" command. it will create a new ssh keys for your account. you can now push to your account easily.
Suppose if you want to push to any application using your old account replace the .ssh/ folder files to backuped files. (Backup your current .ssh/ to any folder)
or you can repeat same step 1-4 for that account.
I hope this will solve your problem.

Git pushes files to github with wrong username

I'm trying to push my committed changes to Github using Terminal on Mac OS but
it keeps saying that the access to the repository is denied to my old github user
Permission to myuser/test1.git denied to "OldUser".
fatal: unable to access 'https://github.com/"NewUser"/test1.git/': The requested URL returned error: 403
I found some similar problems but none of the answers worked for me:
First of all Iv'e removed all the SSH keys from my mac and created a new one which I then synced with my github account.
Second, I have set the Global config for git to my new username and email using
git config --global user.name AND user.email
When I changed the user and email in the git local config file in my project dir (thinking at least that would work), I was surprised to see the same error when pushing, with my old user name popping out again.. (I really thought a local config would override any old global values) I just don't know where to look anymore..
There are no git environment variables defined and the SSH keys were all re-created.
seems that the last option is to re-install git which would be a really ugly way out..
Oh! BTW when i'm trying to push to github using the dedicated MacOS app it works just fine! I wasn't surprised a bit because all users reporting this problem said that the app worked for them just fine.. Just thought I mention it!
So, if anyone got an answer (or at least a hunch) it would help me a lot.
BTW when I'm trying to push to github using the dedicated MacOS app it works just fine!
It is possible the gitHub for Mac is using https url, with your GitHub login/password (which GitHub for Mac is caching).
Check the url associated with your remote origin:
git remote -v
If it is an https url (like your error message suggests "unable to access 'https://github.com/"NewUser"/test1.git/'"), no amount of SSH fiddling will change that error.
Maybe, for http url, the Credential Caching on Mac OS X has still the old credentials.
I had the exact same error on Windows and apparently it's a Git problem. Thanks to ayan4m1 at github forums (https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/152) I finally fixed this issue in Windows using notepad in admin mode to delete the credential.helper = manager lines from the C:\Program Files\Git\mingw64\etc.gitconfig file. Nothing else worked.
Apparently since I was in non-elevated mode in Git bash from my IDE none of my global commands were able to overwrite the global file. Hope this helps and saves time for someone else with this issue.

Source Tree for Windows doesn't seem to work with valid SSH key

I have created an ssh key pair using putty within Source Tree on Windows, and then added that to my repo client (I use Gitlab on a personal server).
This works fine from gitbash (cloning and pushing etc) and via SourceTree for OSX but after adding the .ppk key to pageant, which is actively running and seems to have loaded the key correctly, I cannot seem to clone via SourceTree. I get a "This is not a valid source Path/URL" when adding the repo path with details stating:
fatal: Could not read from remote repository. Please make sure you
have the correct access rights and repository exists.
If I add an existing repo that I have cloned using the same ssh key pair via git bash (by just drag dropping the folder into Source Tree for Windows) that seems to work up to a point - I can commit and see history etc. When I try to Push, however, it fails with much the same message (I've altered the repo path):
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v
--tags origin master:master Pushing to git#MyServer.com:MyRepo.git
fatal: Could not read from remote repository. Please make sure you
have the correct access rights and the repository exists.
Completed with errors, see above.
As far as I can tell Pageant is up and running with the correct (well only) ssh key on my machine.
Any help is very welcomed.
Ok so this is a little embarrasing/confusing.
It would seem that I did not copy the correct public key onto my repo management web interface. The thing is, I copied the public key from git bash using the command:
clip < ~/.ssh/id_rsa.pub
But that seems to give me a different public key from what I actually get opening id_rsa.pub in a text editor...
Is that normal? Why is it different? Why does it work within gitbash and not in SourceTree (via pageant).
Anyway, copying the contents of my public key in directly from the file when opened in notepad got things to work with SourceTree and Pageant etc.

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.

Can't clone my heroku project

I'm not sure what's wrong with my heroku account, but I'm no longer able to clone my heroku project.
NOTE : Please do not close this question considering as duplicate question of this
as I have described below that I tried all solutions mentioned in the answers to that question
! Your key with fingerprint XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX is not authorized to access genqr
Whenever I do
git clone git#heroku.com:genqr.git
I have done everything humanly possible.
1. I have deleted all my keys of heroku added a new key
using
heroku keys:remove
and
heroku keys:add /home/vire2egi/.ssh/setup.pub
Still, the same problem when cloning the project happens.
2. I also added heroku key to ssh-add
ssh-add /home/vire2egi/.ssh/setup
3. Also added key to keychain
eval `keychain --eval setup`
All the above commands result in success but still I can't clone the repo
4. I also did
heroku keys:remove
heroku auth:logout
heroku auth:login ## Authenticated myself and then added the key: still no success
Still no success
5. I also defined a config for heroku, something like
Host heroku.com
Hostname heroku.com
User viren2egi
IdentityFile /home/vire2egi/.ssh/setup
Still no success.
6. Out of fustration I created a brand new key.
ssh-keygen -t rsa
And repeated all the above set for that key too, but still I get the same problem.
I also cleaned my known_hosts everytime I ran anyone of the above commands just to make sure it does not pick from it.
Note :
Whenever I tried heroku:keys, it always presented me with the correct information of the key that I have added
Can anyone help me?
When you do a git operation it uses any ssh keys you have loaded locally in some order (I believe the order in which they were loaded). It may be that you have an old key still loaded and when you do a git operation it tries that key first and fails and does not go on to the next key if there's a failure.
So... try unloading all your ssh-keys with ssh-add -D, then loading the most recent key you created and added to heroku:
$ ssh-add -D
$ ssh-add /home/vire2egi/.ssh/setup
$ git clone git#heroku.com:genqr.git
???
I had the same problem. The steps described in http://rakshasingh.weebly.com/1/post/2013/04/accessing-multiple-heroku-accounts-from-one-machine.html helped me well. Last part about cloning from existing heroku app is important.

Resources