Heroku push failed in Windows + Git bash - windows

I execute:
> heroku login
and introducing my Heroku username and password, I get:
Logged in as l*********.com
I can execute successfully:
> heroku auth:token
cccc8aa0-aaaa-aaaa-aaaa-bbbb03b38932
after that, I execute:
> git push heroku master
but I get:
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry the git command.
remote: ! See documentation for details: https://devcenter.heroku.com/articles/git#http-git-authentication
fatal: Authentication failed for 'https://git.heroku.com/myapp.git/'
What am I doing wrong? It says that I should "not authenticate with username and password using git".. but in that case, what should I do? The docs say:
You cannot authenticate with the Heroku HTTP Git endpoint using your Heroku username (email) and password. Use an API key as described in this section
But it's hard to understand what I should actually do.

I was able to fix it using SSH protocol:
Generate a key: ssh-keygen -t rsa
Upload it to Heroku heroku keys:add
Switching to SSH: git config --global url.ssh://git#heroku.com/.insteadOf https://git.heroku.com/

Related

Deploy to heroku from bitbucket

I want to deploy my app to heroku and here is my pipeline file
image: node:6
clone:
depth: full
pipelines:
default:
- step:
script:
- npm install
- npm test
- git push https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git HEAD:master
I set the HerokuAppkey and herokuappname in enviroment variables, but i've got error
+ git push https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git HEAD:master
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry the git command.
remote: ! See documentation for details: https://devcenter.heroku.com/articles/git#http-git-authentication
fatal: Authentication failed for 'https://heroku:#git.heroku.com/humolite.git/'
Go to Heroku Account Setting then regenerate api key and replace to $HEROKU_API_KEY.
It appears you've set your account's password to $HEROKU_API_KEY. You need to set a valid token instead.
You can use teh heroku authorizations:create command to create a new token locally. Then, configure your CI to have the right value and your deployment should be working.

Push Changes to Git not Functioning

Every time I want to commit the command "git push heroku master" I am asked in the PowerShell to enter the credentials. When I enter heroku credentials (which is connected to git by default) I get the error message.
But, when I type the credetials contained in the netrc file in my home directory, then the thing functions. The password is however hashed in my opinion. How can I avoid entering credentials every time I want to push changes to git?
UPDATE:
PS C:\Users\Dragan\heroku_workspace\python-getting-started> git push heroku master
github --credentials get: github: command not found
Username for 'https://git.heroku.com': my-email#hotmail.com
Password for 'https://my-email#hotmail.com#git.heroku.com':
github --credentials erase: github: command not found
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry the git command.
remote: ! See documentation for details: Https://devcenter.heroku.com/articles/http-git#authentication
fatal: Authentication failed for 'https://git.heroku.com/mysterious-river-71834.git/'
A common mistake is cloning using the default (HTTPS) instead of SSH. You can correct this by going to your repository, clicking the ssh button left to the URL field and updating the URL of your origin remote like this:
git remote set-url origin git#github.com:username/repo.git
or if your repository already then click green button CLONE OR DOWNLOAD and select use SSH
Enable SSH authentication
$ heroku create --ssh-git
Redirect tall HTTPS calls to SSH ( If you want to always use SSH Git with Heroku on a particular machine)
$ git config --global url.ssh://git#heroku.com/.insteadOf https://git.heroku.com/
To generate a public key:
ssh-keygen -t rsa Press enter at the first prompt to use the default file location. Next, type a secure passphrase for the key.
If you are using v1.9.3 or later Git for Windows, you can do the following
git config --global credential.helper wincred
Please note that this mechanism stores your username/password in Windows Credential Store.
In relatively newer versions, Git Credential Manager for Windows is bundled with Git for Windows and enabled by default, you might have to override credential.helper configuration for Heroku. GCM seems designed for VSTS and GitHub and I am not how it will behave with other servers.
Worked for me:
Run heroku login using the windows command prompt cmd.exe. This will drop your API key into your _netrc at which point you can open up cygwin or git bash and do whatever you need to
From .gitconfig remove the helper = manager line so that it is no longer registered as a credential helper and stops it from showing up.
(in C:\Users\username\.gitconfig )
Rename _netrc file to .netrc on Windows 7 in the user dir:
cd %home%
REN _netrc .netrc
see:
'git push heroku master' is still asking for authentication
https://github.com/heroku/cli/issues/84#issuecomment-170689175

Heroku : Username for 'https://git.heroku.com': git

I'm trying to check a git remote on heroku:
$ heroku auth:logout
Local credentials cleared.
$ heroku auth:login
Enter your Heroku credentials.
Email: ***#gmail.com
Password (typing will be hidden):
Authentication successful.
$ git remote
heroku
origin
$ git remote show heroku
Username for 'https://git.heroku.com':
Password for 'https://git.heroku.com':
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry the git command.
fatal: Authentication failed for 'https://git.heroku.com/***-1909.git/'
This error is referenced in the heroku docs, in the screenshot above at https://devcenter.heroku.com/articles/git , but I'm not sure what to do next to fix this.
This is what worked for me.
$ heroku auth:token
Use the result as the password when prompted.
As the warning says, you just need to do:
heroku login
And it will open your browser for logging in, enter details as per your authentication and you will be good to roll in.
I solve this issue no implicit conversion from nil to integer (TypeError) by it by pushing the updates to heroku and when they asked for the user name I added my email and the password it's in this link https://dashboard.heroku.com/account in API KEYS
Username for 'https://git.heroku.com': your email
Password for 'https://email#git.heroku.com': API KEYS
Run this
heroku login
git add .
git commit -m "..."
git push heroku main
This is going to work
After logged with: heroku login
Some access for example on cloning an existing project in your account, is not
allowed using git native even stay you logged in, and only using git from heroku, such as:
heroku git:[command]
an example clonning a repository:
heroku git:clone -a [app_name]
Otherwise, sometimes, after logged with heroku login, you can check your remote git with: git remote -v
Other way, is you use heroku auth:token and use their output as password, of course, run it after logged.

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.

Key not authorized to access app

I went through the tutorial in here https://devcenter.heroku.com/articles/python and then I changed the remote address of git to the one in one of the apps in my dashboard in Heroku. But then after, when I try to push to master, I get
git push heroku master
! Your key with fingerprint 55:55:55:55:55:55 is not authorized to access damp-garden-2012.
fatal: The remote end hung up unexpectedly
I tried ssh-add -d and that didn't work
edit: when i do ssh-add -D and then ssh-add -l I still get:
2048 33:33:33:33:33:33:33 one#email.com (RSA)
2048 44:44:44:44:44:44:44 different#email.com (RSA)
You can check what keys Heroku has via heroku keys, to add a new key use heroku keys:add. More info on managing keys can be found at https://devcenter.heroku.com/articles/keys

Resources