Search Issue Tracker

Fixed in 2021.2.X

Fixed in 2019.4.X, 2020.3.X, 2021.1.X

Votes

14

Found in

2019.4.24f1

2020.3.2f1

2021.1.1f1

2021.2.0a9

Issue ID

1325920

Regression

Yes

Package resolution error when using a Git dependency referencing an annotated tag in its Git URL

Packman

-

How to reproduce:
1. Open attached project "Archive.zip"
2. Open Package Manager window
3. Add a Git dependency to the package using the tag as revision ("git+file://(absolute/path/to/pkg)#v1.0.0", for instance "git+file:///Users/maximeb/UnityProject/Archive/pkg#v1.0.0")

Expected result: The "pkg" package should be successfully added
Actual result: The package is not added to the project and an error is printed in the console:

Reproducible with - 2019.4.24f1,2020.3.2f1,2021.1.1f1,2021.2.0a9, 2021.2.0a14
Not reproducible with - 2019.4.23f1,2020.3.1f1,2021.1.0f1,2021.2.0a8

The error:
"An error occurred while resolving packages:
Project has invalid dependencies:
pkg: 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'"

  1. Resolution Note (fix version 2021.2):

    Fixed in 2021.2.0a15

  2. Resolution Note (fix version 2021.1):

    Fixed in: 2021.1.5f1

  3. Resolution Note (fix version 2020.3):

    Fixed in 2020.3.11f1

  4. Resolution Note (fix version 2019.4):

    Fixed in 2019.4.28f1

Comments (6)

  1. Richard_Lalancette

    Aug 07, 2024 19:13

    After making sure git is in the path, I still get the same issue.

    [Physics::Module] Initialized MultithreadedJobDispatcher with {0} workers.
    [Licensing::Client] Successfully resolved entitlements
    [Package Manager] Done resolving packages in 9.59s seconds
    [Licensing::Client] Successfully resolved entitlement details
    An error occurred while resolving packages:
    Project has invalid dependencies:
    com.browar.editor-toolbox: Error when executing git command. fatal: not in a git directory

    com.eflatun.scenereference: Error when executing git command. fatal: not in a git directory

    com.rlabrecque.steamworks.net: Error when executing git command. fatal: not in a git directory

    A re-import of the project may be required to fix the issue or a manual modification of D:/Seedling_Project/...../Packages/manifest.json file.

  2. achimmihca

    Jun 06, 2021 08:26

    My issues have been solved by now (see https://fogbugz.unity3d.com/default.asp?1336823_c0t2noqpvtu36lhr)

    Root of my issue was that I installed Git on Windows via scoop. And the way scoop handles the link to the Git executable was messing with Unity.

    Solution: put the full path to your Git executable as one of the first entries on your PATH env variable.

  3. achimmihca

    May 06, 2021 16:55

    > it DOESN'T work on 2021.1.5. it is still broken!

    I can confirm this. Still broken with the same error message.
    Just downloaded 2021.1.5f1 and tried it with an URL from GitHub.

  4. NemoStein

    Apr 29, 2021 13:22

    Confirmed that it work on 2021.1.0 but not in 2021.1.1.
    Also, it DOESN'T work on 2021.1.5. it is still broken!

    Trying to install a package from github (e.g.: https://github.com/org/repo.git) throws this error in the console

    [Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/org/repo.git]:
    Could not clone [https://github.com/org/repo.git]. Revision [HEAD] could not be found. [NotFound].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

  5. NoTuxNoBux

    Apr 26, 2021 12:49

    I'm experiencing the same issue as achimmihca, but with 2019.4.24f1; we have an URL like so:

    ```
    ssh://git@gitlab.com/company/repo.git#1.0.2
    ```

    And Unity keeps complaining that this tag does not exist (it does). Using a commit hash doesn't work either, nor does simply not specifying anything using the "#" symbol (then it just complains that "HEAD" cannot be found).

    I've reverted back to Unity 2019.4.18f1, where this works fine, so it must have been broken in a version in between.

  6. achimmihca

    Apr 23, 2021 17:29

    In 2021.1.1f1, I have the issue always when I use the "path" parameter.
    I also tried the suggested workaround, but even with commit ID, branch name or tag name (e.g. "https://github.com/my-user/my-repo.git?path=foo/bar#revision") the issue occurs.

    Thus, the suggested workaround does not seem to work in all cases.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.