'git' is not recognized as an internal or

2019-01-02 19:52发布

I have an installation of Git for Windows, but when I try to use the git command in Command Prompt, I get the following error:

'git' is not recognized as an internal or external command,
operable program or batch file. 

How do I fix this problem?

20条回答
怪性笑人.
2楼-- · 2019-01-02 20:18
  1. Right-click "My Computer",
  2. select "Properties",
  3. open "Advanced",
  4. click "Environment Variables",
  5. highlight the "Path" variable,
  6. click "Edit", add directories to the Path.
    If you installed Git 64bit, without changes to default installation folder, git will be at
    C:\Program Files\Git\bin;C:\Program Files\Git\cmd
  7. change the path with your exact path to git
  8. click OK.

If you don't know where your Git folder is: In windows 7/8/10 git should be found:
- C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
- C:\Program Files\Git\bin;C:\Program Files\Git\cmd

Close the cmd prompt and exit. Then reopen cmd prompt.

查看更多
伤终究还是伤i
3楼-- · 2019-01-02 20:19

On Windows use msysgit to get a bash prompt with a git command.

查看更多
美炸的是我
4楼-- · 2019-01-02 20:21
;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd

add above path in environment variables

note: path may differ but you should add both bin and cmd

查看更多
牵手、夕阳
5楼-- · 2019-01-02 20:22

For Windows 10 Users:

Try running a command prompt window as an administrator. Type:

Git --version

You should receive an answer, something like "git version 2.17.1.windows.2".

If you do receive something similar to the answer above, try running your Git Bash window as an administrator.

Type the same command:

Git --version

You should now see that you are logged in to the Git Bash shell with colored text and everything.

Mine would not work no matter what until I was using the git bash shell as an administrator. Just wanted to share in case someone else encounters a similar issue.

查看更多
泛滥B
6楼-- · 2019-01-02 20:23
  1. Go to My Computer => Local Disk(C:) => Program Files(x86) => Git => cmd
  2. Right Click the git => Select Properties
  3. Under the location Copy the text eg - C:\Program Files (x86)\Git\cmd
  4. Come back to the Desktop
  5. Right-click My Computer
  6. Select property
  7. Open Advanced
  8. Click Environment Variables
  9. In the System variables Find the Variable call Path
  10. Click the variable
  11. Click the Edit Button
  12. Select the Variable value Text Box .
  13. Go to the edge of the text and put semicolon(;)
  14. Then Right-click and press Paste
  15. Press Ok
查看更多
笑指拈花
7楼-- · 2019-01-02 20:26

I installed Git and tried using Command prompt under actions in Team explorer/Changes.

查看更多
登录 后发表回答