I was following this guide here on how to add Git to my Path variable so I can use it from the command line (Not just Git Bash).
Installing Git in PATH with GitHub client for Windows
To quote an answer, Git was supposedly located here
Get the Git URL
We need to get the url of the Git \cmd directory your computer. Git is
located here:
C:\Users\\AppData\Local\GitHub\PortableGit_\bin\git.exe
I opened File Explorer and went to the directory C:\Users\AppData\Local\
Under the view tab, I have Hidden Items checked. I cannot see a GitHub folder listed. In the search bar, I appended GitHub to the end of the directory path and got the following message
Windows can't find 'C:\Users\username\AppData\Local\GitHub'. Check the spelling and try again.
I'm trying to add Git to my environment path variable, but can't find where git is located.
In Git Bash, I was able to try which git where I got /bin/git
But I'm not sure how I can find what to put in under environment variable.
Doing a random search, I actually found that the Git folder was located here
C:\ProgramFiles(x86)\Git
But what am I supposed to enter for the path variable? This is different from the answer in the other question.
Just add the path to the command. This was the path to add to the end of the windows PATH.
C:\Program Files\Git\bin\
Now we should be able to find git.exe by typing
git
It turns out Git was being sneaky!
It was supposed to be installed in AppData/Local, but was actually installed in the Program Files(x86) directory.
I added this to my Path variable after a semicolon
C:\Windows\Program Files(x86)\Git\bin\git.exe
And magically, I can run git again.
For Windows 7 using GIT 2.7.2 I used this in the path under environment variables:
;C:\Program Files\Git\bin;C:\Program Files\Git\bin\cmd. I then typed git --version from a command prompt and got:
git version 2.7.2.windows.1
Another way is found in this place https://stackoverflow.com/a/34767523/5842689
the best thing is you can test if work in cmd.
"o verify, restart cmd and type git --version in cmd"
it works for me cause the real path in my case (Win10 x64)is
C:\Program Files (x86)\Git\bin\git.exe
Related
I'm learning to use Git. After installation I can open a Bash terminal on VS Code (I'm using Windows if that's relevant). Right after opening a Bash terminal, this command shows up automatically (the id and path are masked for privacy):
myid#machineid MINGW64 /c/Users/...
$ source C:/ProgramData/Anaconda3/Scripts/activate base
(base)
I guess it means it's using Anaconda to run the Git command. However, it appears many CMD commands that otherwise work normally in a Windows terminal don't work. For example, I can't create a new folder. This error comes up:
$ mkdir test
bash: /c/ProgramData/Anaconda3/Library/usr/bin/mkdir: Permission denied
(base)
Similarly, commands like ls or touch just don't work. But I find pwd works. I look at /c/ProgramData/Anaconda3/Library/usr/bin and see there are a bunch of CMD command exe files in there, such as mkdir.exe, rm.exe. I also look at the Git installation directory and find a folder with similar exe commands (C:\Program Files\Git\usr\bin)
On the other hand, I can still use Git commands. So this works (after manually creating the folder test):
$ git init
Initialized empty Git repository in C:/Users/.../test/.git/
(base)
Also, if I don't use VS Code, but use a Git CMD then everything works just fine.
So the question is how I can fix it? More specifically, how can I direct Git to use Git command base in VS Code instead of depending on Anaconda base? What it currently means to me is that if I uninstall Anaconda then Git may not work in VS Code at all.
I installed git and Heroku on my Windows8.1 64bit machine. On running:heroku --version I get the following error:
bash: heroku: command not found
What must I do to enable it?
Installing Heroku Toolbelt on Windows 10
bash: heroku: command not found
The error message is clear: Bash cannot find the heroku command, it's not on your PATH.
I checked, and the Heroku folder was added to the PATH.
It seems you didn't check it correctly.
Note that even if it looks correct in the PATH settings window,
Git Bash might have a different PATH configured.
To see the PATH in Git Bash, run:
echo $PATH
When debugging path issues,
it's best to first run heroku with the absolute path. For example if it's in C:\Program Files\Heroku\bin\heroku then you can run in Git Bash with:
/c/Program\ Files/Heroku/bin/heroku login
If this works (and it should),
then you can add it to PATH like this:
PATH="$PATH:/c/Program\ Files/Heroku/bin"
Note that Heroku will likely need other programs too on the PATH,
such as MySQL and Ruby.
Find their absolute paths,
and add there directories to PATH the same way as heroku itself in the above example.
If instead of Git Bash,
you want to work in CMD,
the procedure is the same,
but the syntax to print and set PATH is different:
echo %PATH%
set PATH="C:\Program Files\Heroku\bin;%PATH%"
I've been having some issues installing the Heroku toolbelt on Windows 10, 64-bit.
It's the first time I install Heroku. I downloaded it from https://toolbelt.heroku.com/windows.
After installing, I tried launching a new Git Bash and typing heroku login but what I got back was bash: heroku: command not found
Running the same command on Windows Powershell, what I got back was
'MYSQL' is not recognized as an internal or external command,
operable program or batch file.
'MYSQL' is not recognized as an internal or external command,
operable program or batch file.
Any suggestions? I thought that googling those lines would help, but I haven't found much.
I followed the recommendation from here, but now when typing heroku login on the Powershell, nothing happens. Nothing changes on the Git Bash.
I checked, and the Heroku folder was added to the PATH.
I thought I'd ask for some help before installing anything else.
Thank you!
bash: heroku: command not found
The error message is clear: Bash cannot find the heroku command, it's not on your PATH.
I checked, and the Heroku folder was added to the PATH.
It seems you didn't check it correctly.
Note that even if it looks correct in the PATH settings window,
Git Bash might have a different PATH configured.
To see the PATH in Git Bash, run:
echo $PATH
When debugging path issues,
it's best to first run heroku with the absolute path. For example if it's in C:\Program Files\Heroku\bin\heroku then you can run in Git Bash with:
/c/Program\ Files/Heroku/bin/heroku login
If this works (and it should),
then you can add it to PATH like this:
PATH="$PATH:/c/Program\ Files/Heroku/bin"
Note that Heroku will likely need other programs too on the PATH,
such as MySQL and Ruby.
Find their absolute paths,
and add there directories to PATH the same way as heroku itself in the above example.
If instead of Git Bash,
you want to work in CMD,
the procedure is the same,
but the syntax to print and set PATH is different:
echo %PATH%
set PATH="C:\Program Files\Heroku\bin;%PATH%"
In windows bash instead of this
PATH="$PATH:/c/Program\ Files/Heroku/bin"
use this
PATH="$PATH:/c/Program Files/Heroku/bin"
My working solution (for git-bash especially) is:
alias heroku='winpty `where heroku.cmd`'
stored in .bashrc in home user dir
and them
heroku
works as expected
If using bash from VSCode, I had to restart VSCode, after installing heroku. If not using VSCode, you probably need to restart your bash terminal, after installing heroku.
In Control Panel\All Control Panel Items\System (if you are using Windows), go to Advanced system settings, and there in Environment Variables, you'll find two lists, on the same window, viz. System variables, and User variables for your system. Make sure you add your path, viz. C:/Program Files/Heroku/bin, in both of these lists.
I know this is an old thread and just want to share my solution.
Edit .bashrc for git-bash
alias heroku='"C:\Program Files\Heroku\bin\heroku.cmd" $#'
I have installed git and git-annex on my Windows 8 to use with git bash. Git is ok, but git bash could not find git annex at first. I restarted my computer and now when it turns on a message pops up saying it cannot find git-annex-autostart.vbs. However the file is indeed at the path the start up script is looking for (C:\Program Files (x86)\Git). Any suggestions?
Answer found: just had to find git-annex.exe (look for the cmd folder under your git installation) and add to PATH:
$ export PATH=$PATH:/c/Program\ Files\ \\(x86\\)/Git/cmd/./
I have installed GIT for Windows right now. And when I am running this into my symfony project to reinstall the vendors by
php bin/vendors install --reinstall
Then i am getting an error
git' is not recognized as internal or external command
I have set the environmental variables also as
c:/programme files/git/cmd
Now what should I do?
I have tried also for environmental variables
c:/program files/git/bin
but I am getting the same error
Two possible solutions:
My PATH has backslashes instead of forward ones.
your first line contains a typo, should be c:\program files\git\cmd
One more: If your path includes spaces, enclose it in quotes:
set PATH=%PATH%;"C:\Program Files\Git\cmd"
During Git installation, in the path environment settings chose the following one.
Even I had the same problem, of git not executed on my normal Command Line, but i just reinstalled it with the setting "Run Git from the Windows Command Prompt"
Just open cmd and run this command:
set PATH=%PATH%;"C:\Program Files\Git\cmd"