Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Git URL revision not found (still in Unity 2021.1.5f1)

Discussion in 'Package Manager' started by achimmihca, May 6, 2021.

  1. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    I am trying to use a Git URL to include a package in my project:

    manifest.json:
    Code (CSharp):
    1. {
    2. ...
    3. "com.achimmihca.protrans": "https://github.com/achimmihca/ProTrans.git?path=ProTrans/Packages/com.achimmihca.ProTrans#v1.0.0"
    4. }
    Note that the tag "v1.0.0" exists.

    Unity gives me an error message:
    Code (CSharp):
    1. Project has invalid dependencies:
    2.     com.achimmihca.protrans: Could not clone [https://github.com/achimmihca/ProTrans.git]. Revision [v1.0.0] could not be found.
    When I replace "v1.0.0" with a commit hash, then it is complaining that the commit hash is not found. When I remove the revision completely, then it complains that HEAD could not be found.

    Now, there is an issue for it namely, https://issuetracker.unity3d.com/is...y-referencing-an-annotated-tag-in-its-git-url

    The issue is supposed to be fixed in 2021.1.5f1. However, I still experience the same error with this version.

    - Am I doing something wrong or is the issue still not fixed?
    - Can the Package Manager update itself or do I have to wait for the next Unity release that includes a fix?
    - Could someone please reopen the issue if it is not fixed yet?
     
  2. supita_unity

    supita_unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    225
    I'm sorry that you are still having this issue. Please submit a new bug with the reproduction steps, add the information of the bug submitted and if you can add a reference to the new bug created here so I can follow up on it.
    What version of git you are using locally, what Operative System? I just tried to reproduce the problem you are describing, but I was able to add the package on 2021.1.6f1 on MacOs. I added in my manifest.json

    Code (CSharp):
    1. "com.achimmihca.protrans": "https://github.com/achimmihca/ProTrans.git?path=ProTrans/Packages/com.achimmihca.ProTrans#v1.0.0",
    and I can see the package in the Package Manager Window
    upload_2021-5-6_15-25-14.png

    I checked in the lock file, and the correct commit hash was retrieved: 7a2c6db6ee97aaf935c7f56774b5809650e6180b
     
  3. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    481
    Hi @achimmihca,

    After looking at the error message you're having, we found that this seems to be a different issue you're running into. The issue that's been fixed would fail with a message like
    Code (CSharp):
    1. Error when executing git command. fatal: update_ref failed for ref 'HEAD': cannot update ref 'refs/heads/master': trying to write non-commit object 1701a603f21da447f378b943e707522dfd4d5ddc to branch 'refs/heads/master'"
    The errors you're running into seem to be different. We are unable to reproduce this with your Git URL. Would you mind opening a new Bug Report with an Editor session where this happens and posting the issue number here? Can you also make sure to include your Git version in the bug report description?

    If possible, it would be very useful if you could enable extra UPM Git traces in the upm.log before submitting the bug report. To do this, follow these steps:
    1) Set the following environment variable set before launching the Editor:
    GIT_TRACE=1

    2) Set the Package Manager Log Level to "Debug" in the Preferences (see screenshot below)
    upload_2021-5-7_10-52-37.png
    3) Reproduce the error (e.g. change your Git dependency URL to force the Package Manager to resolve it again)
    4) Submit the bug report with Help > Report a Bug...

    Thank you very much!
     
  4. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    supita_unity likes this.
  5. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    I forgot how to log in to FogBugz. Please, find the upm.log in the attached zip file.
     

    Attached Files:

  6. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    The issue has been solved.
    Solution: put the direct path to your git executable (without any links or other proxies) on your PATH (before any other entry that points to a git executable).

    I had problems because I had installed git via scoop (https://scoop.sh).
    Scoop somehow links to the git executable (in "shims" folder) instead of using the git executable directly. As a result, Unity could not communicate with git as needed (for some reason).
    I removed git.exe from scoop's "shim" folder and added an entry to the git executable on PATH. Now it is working.
     
  7. unfitforbingo

    unfitforbingo

    Joined:
    Jul 28, 2017
    Posts:
    3
    There should be a setting in External Tools to give a path to git.exe. Most IDEs that rely on git have this sort of setting.

    Either that or Unity should package its own copy of git.

    I also use scoop and really don't want to screw up the scoop folder structure just because Unity is borked.

    Edit: Scoop issue tracking this: https://github.com/lukesampson/scoop/issues/4317. There is another workaround on that issue which works within the scoop system.

    Edit2: Workaround fails.

    Code (CSharp):
    1. C:\WINDOWS\system32>where git
    2. C:\Users\snip\scoop\apps\git\current\cmd\git.exe
    3. C:\Users\snip\scoop\shims\git.exe
    Proper git exe first in path. Still Unity seems to want to use the shim.

    Edit3: Restarting Unity didn't work, but after a full PC restart (I was desperate), Unity now picks up the correct git path. Hooray! :)
     
    Last edited: Jul 31, 2021
    tealm and HamledLLC like this.
  8. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    > Unity should package its own copy of git.

    That's what I thought as well. Maybe there is a license issue, IDK...
     
  9. Trond_Tactile

    Trond_Tactile

    Joined:
    May 25, 2016
    Posts:
    17
    So... Is there any official fix for this? Is the only way to deal with this to actually mess about with the git manifest from scoop?
     
  10. raincole

    raincole

    Joined:
    Sep 14, 2012
    Posts:
    62
    Bump on this. Why can't we just manually set the path to git executable?
     
  11. tealm

    tealm

    Joined:
    Feb 4, 2014
    Posts:
    108
    Second this! We can already set paths to external tools - please just add the option to set a path to git as well.
     
  12. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    266
    Windows finally has a package manager that is supported by Microsoft itself: winget

    Example:
    Code (csharp):
    1. winget install git.git
    2. winget search notepadplusplus
    For me, this makes Scoop and Chocolatey obsolete.
    Advantages of winget:
    - it is pre-installed on new Windows versions
    - the apps sometimes integrate better in Windows
    - the shell that runs winget does not need admin permissions, winget will ask when needed

    Winget installs apps to the usual paths on Windows (like Chocolatey).
    Scoop on the other hand was installing apps inside the user's home directory. This has the advantage that no admin permissions are needed for scoop, but sometimes it was causing confusion.

    Anyway, I will use winget from now on.
     
    tealm likes this.