I was able to use heroku login with my windows power shell successfully. However, when running the latest version of Git Bash and running the same heroku login command, after it asks for my email and I enter it I get the following message:
!Login is currently incompatible with git bash/Cygwin/MinGW
Any ideas on how to fix this so I can access Heroku on my Git Bash?
A fix is discussed as a github issue here. You may not have the Path properly set. Some indicate success with logging in via cmd first. If logging via windows cmd doesn't work, exit git bash, login on cmd then restart git bash.
The answer I posted in reply to Push Changes to Git not Functioning 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
Related
Last week I created a git repo for a project. This morning, I tried git status which results in fatal: detected dubious ownership in repository at 'C:/ProjectPath/ProjectName'.
I believe I created the git repository using an administrator command prompt, so I tried git status in an administrator command prompt and it works. The same results happen when I use the Git Bash: it works when run as an administrator.
How can I change the repo's ownership to allow non-administrative usage? This SO question suggests multiple solutions using sudo; however, these are not applicable to git for windows: sudo echo test returns bash: sudo: command not found.
These two answers contain details on how to change owner of directory or file in Windows:
https://stackoverflow.com/a/73265433/1339137
https://stackoverflow.com/a/73875183/1339137
I'm using Windows 10 and Git Bash for my CLI. I have tried logging in through the default browser pop up as well as using $ heroku login -i to force a login using the CLI. Both have the same result, it says I have successfully logged in but the cursor just sits flashing under where it says I'm logged in and any command entered is ignored, it just advances to the next line.
CLI Window showing stuck cursor
I have made sure I am on the latest version of Git Bash (v2.34.1) and the heroku cli is also up to date (v7.59.2). I have also uninstalled and reinstalled Git Bash.
I did see a similar post where the same thing was happening to someone and they said they could login through the windows terminal and they were going to try uninstalling/reinstalling git bash but they never followed up with whether that worked or not (it didn't for me). I also was able to successfully login using the windows terminal but I'm just curious if there is a known fix for this issue so I can keep using git bash.
I want to push a project I created to Heroku from Git. I'm running windows and have the Git Bash shell installed as well as the Heroku CLI. Running this from Git Bash shows my Git version:
$ git --version
git version 2.14.1.windows.1
However, when I try from that same Git Bash shell to create my application on Heroku as a remote Git repo, I get an error:
$ heroku create
bash: heroku: command not found
So instead I created my application on Heroku from a regular windows cmd terminal and that worked (i.e., when I log into heroku I see the remote repo). But when I try to do a git push from the windows cmd terminal it does not recognize git:
C:\myapp>git push heroku master
'git' is not recognized as an internal or external command,
operable program or batch file.
Whereas when I try to do a git push from the git bash shell, I get this error indicating perhaps it doesn't know what to make of heroku:
$ git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
So it seems my regular windows cmd terminal recognizes heroku, but my Git bash terminal does not. How do I configure Git bash to recognize the Heroku command?
Note: When I do a env | grep path from the Git bash shell the results do include my C:/Program Files/Heroku/bin directory, so Git is aware of my Heroku path.
Your problem is not that git would not push to heroku, but that you actually haven't installed git on your system, as the message you posted suggests.
'git' is not recognized as an internal or external command,
operable program or batch file.
At heroku's documentation there is a whole article about pushing to git, if you experience further problems after installing git, you might find a solution there.
Found a solution! It required the following 3 steps/considerations:
First, I followed john g's answer here, which is to close Git Bash and login to Heroku via a windows cmd terminal, then use Git Bash as per normal.
Second, when issuing a heroku command from Git Bash on Windows, include the extension, as described here. I.e., issue heroku.cmd create (instead of just heroku create).
Third, apparently the git push heroku master command must be issued from the same Git Bash terminal where you just issued heroku.cmd create. When I had issued it from a separate terminal I got an error saying "'heroku' does not appear to be a git repository".
I'm posting this, in hopes that it may help others and save them the same trouble I had. This was driving me mad and I tried every solution I could manage to find on the issue. Spent several hours trying to trouble-shoot it. What it actually ended up being was a conflict with my internet security, specifically Comodo Internet Security Premium 10. I received no warning, it just automatically added it to a blocked list on first execution. If you are running internet security software, especially on a Windows machine, this very well could be your issue. Remove the command file found at C:\Users\YOUR_USER_NAME\AppData\Local\heroku\client\bin\heroku.cmd from any block list, as well as any other executables from heroku that may be on the list.
I wanted to try and use git in my regular Windows prompt instead of in Git Bash. Simply for the reason that I could then use the terminal that IntelliJ provides. I figured it to be a 1 minute fix but I guess not.
When I try to git pull origin <branch> I get the following error message:
C:\Users\Username\Documents\Bitbucket\java-project>git pull
Could not create directory '/c/Username/.ssh'.
The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
RSA key fingerprint is 12:8c:1b:f2:6d:14:6b:5c:3b:ec:aa:46:46:xy:7c:40.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/c/Username/.ssh/known_hosts).
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have set the permissions on the existing .ssh folder such that all Users have full access, administrators and SYSTEM. So that should be okay.
I also tried to run the prompt as Administrator to see if that was the issue but that's not the case either.
What I do notice now is that it says: Could not create directory '/c/Username/.ssh'.. However, my .ssh directory is located at C:\Users\Username\.ssh. I might need to change my configuration then.
Git version: 1.9.0.msysgit.0
Windows version: Windows 8.1
First of all, tested with msysgit 1.9.2, when one selects to make just git command available from cmd.exe during installation (where other choices are, make it avaiable only under git bash, or make all MSYS commands available under cmd.exe), git clone works from cmd.exe prompt.
The ssh client uses HOME environment variable to find .ssh/ directory, but git should take care of all the ugly details. You should not have HOME defined in your normal Windows environment, so if echo %HOME% in cmd.exe prompt prints a path, edit the OS environment variables and remove HOME.
If that does not solve it, uninstalling and installing latest version might help.
Finally, you have paths like C:UsersUsername, it probably means you're missing quotes somewhere. In git bash, try these two commands to see:
echo C:\Users\Username
echo 'C:\Users\Username'
Make sure you type your cmd session the git-cmd.bat which comes with every Git For Windows msysgit release.
That will set your HOME to %USERPROFILE%, which should be C:\Users\Username.
But make sure you didn't have an environment variable HOME already defined with an incorrect value: unset it if that is the case.
Open Git Bash console.
Perform the command below to enable read and write;
chmod 776 your local path here/known_hosts
More details here
There are many fine instructions about how to work with git under windows using GitBash.
I note that when git is installed, it offers the option of "set up for using git from the windows prompt", which puts git on the windows path.
Is there some way to set this up so that ssh authentication works?
At the moment I get "permission denied (publickey)" when I try to do git commands that access the remote.
(edit) I have set %HOME% to point to my Windows home directory, and there is a .ssh folder in there with id files that work under a gitbash shell.
I appreciate that the answer is likely "no, this is why GitBash exists". But - it would be good to know for sure.
If the answer is "no" it kinda makes you wonder why you would bother putting git on your windows path?
ssh access works fine from a regular DOS session.
You only need to define C:\Users\YourAccount\.ssh and add your id_rsa and id_rsa.pub there.
Launch your git session through git-cmd.bat, which will define %HOME% to your C:\Users\YourAccount: that is what will make ssh work.
This should put your msysgit/bin installation in your PATH.
I really recommend not installing through a msi (Microsoft Installer), but through a simple unzip of an archive (portable version "PortableGit-x.y.z-preview201ymmdd.7z")
And the OP GreenAsJade's comment points out the fact that GIT_SSH must point to plink.exe.
Well, maybe I have a process that seems to work.
If you use a passphrase during the generation of the keys, you'll have to type this passphrase after loading an ssh-agent and add the key to the agent.
Basically, the solution is: follow the instructions on this page:
https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html
BUT, during the generation of the keys DO NOT TYPE A PASSPHRASE.
Obviously, it's 'weaker' from a security point of view.
But, the .bashrc script will work as expected (loading the identity on git bash startup).
You can use then the "start-ssh-agent.cmd" script located on Git\cmd folder. It will open a Dos Prompt with the identity loaded and everything will work!