Installing Git in PATH with GitHub client for Wind

2019-01-02 14:42发布

How do I install Git in my PATH when using the GitHub client for Windows?

I'm running into errors because apparently Git is not installed in PATH. For example, using Atom, trying to install the Linter plugin gives this error:

npm ERR! not found: git
npm ERR! 
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

Does GitHub for Windows install Git when it installs? (It must, otherwise how does it use Git?) I don't want to double-install it... so how do I just add the Git that's already there to PATH?

11条回答
步步皆殇っ
2楼-- · 2019-01-02 15:27

I installed GitHubDesktop on Windows 10 and git.exe is located there: C:\Users\john\AppData\Local\GitHubDesktop\app-0.7.2\resources\app\git\cmd\git.exe

查看更多
君临天下
3楼-- · 2019-01-02 15:31

Thanks everyone who have answered.I have seen all answers and to try to make it easy for everyone

Step 1: Type edit environment and select the option shown

enter image description here

Step 2: Select Path and click on edit

enter image description here

Step 3: In the end add the below statement(you can avoid the first ; if its already there)

;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd

enter image description here

Step 4:- Click on ok

enter image description here

Step 5 :- One of the important step which is highlighted by one of the user. thanks to him

**

  • Close command prompt and restart before trying the below command

**

Here is the magic

enter image description here

查看更多
高级女魔头
4楼-- · 2019-01-02 15:32

If you use SmartGit on Windows, the executable might be here:

c:\Program Files (x86)\SmartGit\git\bin\git.exe
查看更多
十年一品温如言
5楼-- · 2019-01-02 15:33

I would like to add one more thing to what the other answers have said. It is not compulsory that path will be:

C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\bin\git.exe

In my computer I did not found Git there.

BUT git and cmd are located in

git.exe

C:\Program Files\Git\bin\git.exe

cmd

C:\Program Files\Git\cmd

To add into PATH:

  • Right-Click on My Computer
  • Click on Advanced System Settings
  • Click on Environment Variables
  • Then, under System Variables, look for the path variable and click edit
  • Add the path to git’s bin and cmd at the end of the string like this:

    ;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd

OR

;C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\bin;C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\cmd

To verify, restart cmd and type git --version in cmd

查看更多
墨雨无痕
6楼-- · 2019-01-02 15:38

Git’s executable is actually located in: C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\bin\git.exe

Now that we have located the executable all we have to do is add it to our PATH:

  • Right-Click on My Computer
  • Click Advanced System Settings
  • Click Environment Variables
  • Then under System Variables look for the path variable and click edit
  • Add the path to git’s bin and cmd at the end of the string like this:

;C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\bin;C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\cmd

查看更多
登录 后发表回答