Search Unity

No 'git' executable was found. Please install Git on your system and restart Unity

Discussion in 'Package Manager' started by mnarimani, Aug 19, 2019.

  1. mnarimani

    mnarimani

    Joined:
    Mar 27, 2017
    Posts:
    214
    I get this error when I add git repo to packages. Unity 2019.3.0a11. How can I solve this?
     
  2. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    65
    I think this post could help you:

    https://forum.unity.com/threads/git-support-on-package-manager.573673/

    Please take a look at the `Requirements` section.


     
  3. mnarimani

    mnarimani

    Joined:
    Mar 27, 2017
    Posts:
    214
    Git is in my PATH variable. When I write 'git' in PowerShell, it brings up git manual.
     
  4. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    65
    Could you check where exactly is your git installed? Are you using a custom distribution of git?
     
  5. mnarimani

    mnarimani

    Joined:
    Mar 27, 2017
    Posts:
    214
    I have Git for Windows. I have installed it in "C:\Program Files\Git" directory. "C:\Program Files\Git\bin" has been added to my PATH variables.
     
  6. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    65
    Could you try having `C:\Program Files\Git\cmd` in your path instead of `C:\Program Files\Git\bin` and see if it works?
     
  7. mnarimani

    mnarimani

    Joined:
    Mar 27, 2017
    Posts:
    214
    I changed the path variable to point to `C:\Program Files\Git\cmd` but it doesn't work. Writing git in powershell still works.
    When I write 'git --version' in powershell, I get this:
    git version 2.21.0.windows.1

    Is the version ok?

    I don't know if it's useful to file a bug report since it happens in a literally empty project.
    These are the steps that I do:
    1- Create a new project (Unity 2019.3.0a11)
    2- Open pacakge manager window
    3- Click on the plus button and choose 'Add package from git url'
    4- Enter 'https://github.com/omid3098/OpenTerminal.git' and press 'Add'
    And this error is printed in the console:
    Cannot perform upm operation: Unable to add package [https://github.com/omid3098/OpenTerminal.git]:
    No 'git' executable was found. Please install Git on your system and restart Unity [NotFound]
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
     
  8. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    72
    Hi @mnarimani,

    We would really like to get to the bottom of this!

    Could you try running the following in cmd.exe and not in PowerShell:

    where git
     
  9. mnarimani

    mnarimani

    Joined:
    Mar 27, 2017
    Posts:
    214
    This is the result of running 'where git' in cmd (I opened non-administrator cmd):
    "C:\Program Files\Git\cmd\git.exe"
     
  10. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    76
    Same problem happens to me. Is there any update on how to solve this?
     
  11. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    72
    @mnarimani There appears to be an issue with the way we look for git in your PATH. To help us debug the issue, would you mind sharing your PATH value by running the following command in cmd:

    echo %PATH%


    Please feel free to anonymize any personal information like your username. Thank you!

    Edit: If you prefer, you can send this in a direct message by clicking my username and then "Start conversation"
     
  12. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    72
    Hi @grogshotgames,

    Can you make sure that you've quit and restarted Unity as well as Unity Hub since making any changes to your PATH? This is important because Unity Hub will pass the environment it was started with on to the Unity editor. Is it possible you started Unity Hub before making the changes to your PATH?
     
    rocket5tim likes this.
  13. mnarimani

    mnarimani

    Joined:
    Mar 27, 2017
    Posts:
    214
    Restarting Unity Hub solved my issue.
    Thanks!
     
    rocket5tim likes this.
  14. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    72
    Great! We are going to update the "Please install Git on your system and restart Unity" message to include Unity Hub
     
    rocket5tim likes this.
  15. Noxalus

    Noxalus

    Joined:
    Jan 9, 2018
    Posts:
    35
    Hello,

    I'm here for the same problem and I'm still struggling to make it work properly.

    In my case, I have a project with a git dependency in the manifest.json file using the git:// scheme:

    Code (JavaScript):
    1. {
    2.   "dependencies": {
    3.     ...
    4.     "com.e7.notch-solution": "git://github.com/5argon/NotchSolution.git#5ce344a771045c0dae52205e7be49bdda79bbc96"
    5.   }
    6. }
    Each time I try to open the project with Unity 2018.3.14f1 (Unity Hub 2.2.1) I get this error message:

    upload_2019-12-4_23-20-23.png

    I've tried a lot of things, including an installation of Git in a custom folder. It appears in the PATH, I can use the git command from the Windows command line (cmd.exe) and where git give me this:

    upload_2019-12-4_23-20-41.png

    I've restarted the Hub multiple times and even reboot my computer but I still have this error.

    I've also tried with Unity 2019.3.0f1, it's the same issue.

    The only thing that make it work is to launch the editor from the Editor folder directly, not from the Unity Hub, but I don't really know why and how to fix it...

    Do you have any idea?
     
    Last edited: Dec 4, 2019
    MikeITS likes this.
  16. MikeITS

    MikeITS

    Joined:
    Apr 3, 2015
    Posts:
    4
    I've ran into this problem as well.

    Windows 10 Pro 64-bit
    Unity Hub 2.2.1
    git version 2.24.0.windows.2 (64-bit)
    Unity 2019.2.15f1

    System-level PATH includes "C:\Program Files\Git\cmd" at the very beginning.
    "where git" in cmd.exe returns "C:\Program Files\Git\cmd\git.exe"

    Steps:
    1. Create an empty project using the "3D" template (the template used probably does not matter though). Unity opens this project without errors.
    2. Close Unity.
    3. Modify the project's manifest.json to include
      "com.unity.2d.tilemap.extras": "https://github.com/Unity-Technologies/2d-extras.git#master",
    4. Open the project again. The "No 'git' executable was found" error is displayed.
    Tested Versions:
    1. Unity 2019.2.15f1
    2. Unity 2019.2.9f1
    3. Unity 2019.1.12f1
    Attempted Solutions:
    1. Restarted Unity and Unity Hub.
    2. Restarted Windows.
    3. Installed the latest version of Git for Windows: 2.24.0 (64-bit)
    4. Cleared the project's Library and Temp directories.
    5. Moved the directory from in the middle of the PATH variable to the beginning.
    6. Reinstalled Unity Hub.

    This just started happening, after installing the new version of Unity Hub and Unity 2019.2.15f1. This problem also happens on other projects which were working fine up until now.
     
    Last edited: Dec 10, 2019 at 9:45 PM
  17. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    65
    HI there,

    There is a known issue related to environment variables with the latest version of Hub. The issue will be fixed in the next release (ETA next week or so).

    For now, it looks like launching the editor from the Editor folder directly might be the best work-around. (thanks @Noxalus).

    Best,
    Ethan
     
    MikeITS likes this.
  18. MikeITS

    MikeITS

    Joined:
    Apr 3, 2015
    Posts:
    4
    Unfortunately, when I try to open Unity.exe from the Unity\Hub\Editor folder, it just opens Unity Hub. There is a version of the editor in Unity\Editor which works, but it's version 2018.2 and I need 2019.2. I am currently downloading the Unity 2019.2.15f1 installer from the download archive to see if that version will work without Unity Hub.

    Edit: If you uninstall Unity Hub, you can run the Unity editor from Unity\Hub\Editor. Posting this in case it helps anyone else.

    Sorry for not saying this earlier; thank you for the response Ethan :) It's good to know that a solution is coming soon.
     
    Last edited: Dec 10, 2019 at 10:10 PM
  19. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    596
    Had the same problem, but if set "Load Previous Project On Startup", it does not open the the hub. That workaround of course only makes sense if you have just one main repo you're working on.
    upload_2019-12-11_9-12-19.png
     
    MikeITS likes this.