Command-line Git on Windows

前端 未结 9 1933
悲&欢浪女
悲&欢浪女 2020-12-07 09:44

I have installed msysGit 1.7.10 on my Windows 7 machine. What I need to know is if I can still use Git from command line?

When I try the git command in

相关标签:
9条回答
  • 2020-12-07 10:01

    If you have installed GitHubDesktop in Windows 10, then press Ctrl + '. or in the menu go to Repository>Open in command prompt.

    In case git is not installed in your machine, you should get a prompt to install git.(I came to know from this that GitHubDesktop and git are different applications). Install git, close your command prompt and open it again.

    You can test your installation by typing in git at the command prompt.

    0 讨论(0)
  • 2020-12-07 10:06

    I had the same issue and resolved it by adding the /bin directory location to the PATH Environment Variable.

    1. Search for the file location where Git was installed, mine is C:\Users\(My UserName)\AppData\Local\GitHub. It may also be C:\Program Files (x86)\Git

    2. Once you have the location of Git you should see a /bin sub-folder. It may be in a PortableGit folder (mine is PortableGit_015aa71ef18c047ce8509ffb2f9e4bb0e3e73f13). Copy this path.

    3. Go to Control Panel > System > System Protection > Advanced > Environment Variables

    4. Choose PATH, click edit and paste the bin path there. If there are already any values in your PATH paste your Git path at the end separated with a semi-colon.

    Now you can access Git command from CMD.

    0 讨论(0)
  • 2020-12-07 10:19

    As @birryree said, add msysgit's binary to your PATH, or use Git Bash (installed with msysgit as far as I remember) which is better than Windows' console and similar to the Unix one.

    0 讨论(0)
  • 2020-12-07 10:19

    as of now, with win 1909 and using Git-2.24.0.2-64-bit installer the process is very friendly towards user configuration. Seems like the earlier problems may now be catered for.

    0 讨论(0)
  • 2020-12-07 10:21

    In windows 8.1, setting the PATH Environment Variable to Git's bin directory didn't work for me. Instead, I had to use the cmd directory C:\Program Files (x86)\Git\cmd.

    Credit to @VonC in this question

    0 讨论(0)
  • 2020-12-07 10:22

    For me, I'm using Windows 10, @andrew-marshall's instructions worked (Thanks!) except that git.exe was within a cmd directory within PortableGit..., not bin, so I had to put \cmd on the end of the path I added to PATH. Thought I would post this here in case anyone else hits the same issue. You can tell it works once git in a new Command Prompt window returns command usage info and not an error.

    0 讨论(0)
提交回复
热议问题