Unable to Add Git package (Solved)

So I've been trying to install a git package for networking and it is giving me multiple errors when I try. The errors for the package url "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main" are as follows.

[Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main ]:
Error when executing git command. fatal: invalid refspec 'main '
[NotFound].
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

And

[Package Manager Window] Error adding package: https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main .
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

I have tried googling about but either get solutions for Git pull using Git itself or similar but seemingly unrelated issues in Unity. I have restarted the hub and Unity and even my PC. I have successfully installed the packages "com.unity.netcode.gameobjects" "https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync" successfully and am wondering if the issue is something I've done or if the specific url for the failed package install is due to the target git or URL. I apologise for my ignorance I don't have much experience using Git.

1 Like

I am also having this exact issue. Please help!

1 Like

I found a solution.
Navigate to "[Project root]/packages" and open the Manifest.json file in Notepad++ or desired editor.
Under dependencies add

"com.unity.multiplayer.samples.coop": "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main",

Save it and then start unity. It might fail the first time or two and might give some yellow warnings. If it does restart and they'll go away.

Problem solved.

1 Like

Hi
[quote=“ThatHomelessGuy”, post:3, topic: 890115]
I found a solution.
Navigate to “[Project root]/packages” and open the Manifest.json file in Notepad++ or desired editor.
Under dependencies add

“com.unity.multiplayer.samples.coop”: “https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main”,

Save it and then start unity. It might fail the first time or two and might give some yellow warnings. If it does restart and they’ll go away.

Problem solved.
[/quote]
Hi I got an error trying this solution, “An error occurred while resolving packages: project has invalid dependencies:”

I am also getting this problem, I can't add it via Git url or Manifest.json

hay, i dont know if some still have this issue(i had),
but it worked for me this way:
downloaded the zip-file,
extracted it
and after that add it manually via"Package Manager/Add/Add Package from disk",

the desired package showed then up in the "Packages: In Project" filtered tab.

16 Likes

Hi everyone,

If there are trailing spaces in the string (Git URL, file path...) that you paste in the project manifest, it will not work. This might be the issue for some of you. For instance, trying to add "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main " (without quotes) will definitely not work, but trying to add "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main" (without quotes) should work.

Newer versions of the Editor trim these strings when you add them via the Package Manager window (at least 2022.1 and newer; I think 2021.3 and older still do not and would fail with the "invalid dependency" error message). However, anytime you directly alter the manifest.json file, whatever is added there is taken as-is.

2 Likes

you must do the simple step:
1- create a new script and name it "ClientNetworkTransform "
2- past this script on ClientNetworkTransform =>
```
using Unity.Netcode.Components;
using UnityEngine;

namespace Unity.Multiplayer.Samples.Utilities.ClientAuthority
{
///


/// Used for syncing a transform with client side changes. This includes host. Pure server as owner isn't supported by this. Please use NetworkTransform
/// for transforms that'll always be owned by the server.
///

[DisallowMultipleComponent]
public class ClientNetworkTransform : NetworkTransform
{
///
/// Used to determine who can write to this transform. Owner client only.
/// This imposes state to the server. This is putting trust on your clients. Make sure no security-sensitive features use this transform.
///

protected override bool OnIsServerAuthoritative()
{
return false;
}
}
}
```

and it will work.

3 Likes

Thankyou

I realised that you can have the same error just because you copied also some empty spaces at the end of the string:
"https://github.com/Unity-Technologies/com.unity.demoteam.hair.git "

Be aware of empty spaces at the end too!

Hope to help,
Rudy

[quote=“Pepsyx3”, post:6, topic: 890115]
hay, i dont know if some still have this issue(i had),
but it worked for me this way:
downloaded the zip-file,
extracted it
and after that add it manually via"Package Manager/Add/Add Package from disk",

the desired package showed then up in the “Packages: In Project” filtered tab.
[/quote]

I followed this and it was a work around. This is after installing git, adding it to the system variables Path etc. and restarted Unity - which still failed, this above solution worked.

[quote=“Pepsyx3”, post:6, topic: 890115]
hay, i dont know if some still have this issue(i had),
but it worked for me this way:
downloaded the zip-file,
extracted it
and after that add it manually via"Package Manager/Add/Add Package from disk",

the desired package showed then up in the “Packages: In Project” filtered tab.
[/quote]

This is work !! thanks

You have to use this path folder path\com.unity.multiplayer.samples.coop-2.0.4\Packages\com.unity.multiplayer.samples.coop\package.json

4 Likes

[quote=“Pepsyx3”, post:6, topic: 890115]
hay, i dont know if some still have this issue(i had),
but it worked for me this way:
downloaded the zip-file,
extracted it
and after that add it manually via"Package Manager/Add/Add Package from disk",

the desired package showed then up in the “Packages: In Project” filtered tab.
[/quote]
Honestly. a LIFE SAVER i was about to give up and i saw this and it worked. so much help like thank you so so so much

[quote=“greensearch”, post:12, topic: 890115]
This is work !! thanks

You have to use this path folder path\com.unity.multiplayer.samples.coop-2.0.4\Packages\com.unity.multiplayer.samples.coop\package.json
[/quote]
i tried adding package.json file from disk in package manager it still shows error

[quote=“SahithJ”, post:14, topic: 890115]
i tried adding package.json file from disk in package manager it still shows error
[/quote]
Same Issue

In the case of people having issues installing the In App Review package from Google's official Github account, here's what you may try.

Check the error messages, they probably tell you you're lacking some packages, for example:

So, before anything else, verify that your project is linked to a Unity Project ID. That might be optional but it doesn't take much to set this up properly. Then make sure you use a correct Project Keystore and same for the Project (game) Key, unless you use a temporary debug one. That may sound weird but since dependencies are involved and somehow related to the installing of these packages, it's known that fetching dependencies does not to work properly when not using a legitimate key. Reasons: popcorn and glitter.

Then, go grab the git URL for the app bundle and install the package, go the Unity Package Manager, then press the top left button [+] > add from (git) URL. To copy the URL, press the green button CODE and copy the Git URL.
https://github.com/google-unity/android-app-bundle
This in theory should work without issue. This allows you to install Play Common next.
https://github.com/google-unity/google-play-common
Next step is to install the Dependency Manager package.
https://github.com/google-unity/external-dependency-manager
You may have already installed it in your Assets, so you could expect a collision there with conflicting resources (errors: multiple assemblies wah wah). One has to go and it's the dependencies manager that you have in Assets.
Then install Play Core:
https://github.com/google-unity/google-play-core
After you have obtained these four packages, you can install In App Review:
https://github.com/google-unity/in-app-review
You're good to go.

like really you got my respect bro, it,s worked

[quote=“Pepsyx3”, post:6, topic: 890115]
hay, i dont know if some still have this issue(i had),
but it worked for me this way:
downloaded the zip-file,
extracted it
and after that add it manually via"Package Manager/Add/Add Package from disk",

the desired package showed then up in the “Packages: In Project” filtered tab.
[/quote]
thanks a lot!!, I was facing the same issue, but now it’s solved!

[quote=“ThatHomelessGuy”, post:1, topic: 890115]
So I’ve been trying to install a git package for networking and it is giving me multiple errors when I try. The errors for the package url “https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main” are as follows.

[Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main ]:
Error when executing git command. fatal: invalid refspec 'main ’
[NotFound].
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

And

[Package Manager Window] Error adding package: https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main .
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

I have tried googling about but either get solutions for Git pull using Git itself or similar but seemingly unrelated issues in Unity. I have restarted the hub and Unity and even my PC. I have successfully installed the packages “com.unity.netcode.gameobjects” “https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync” successfully and am wondering if the issue is something I’ve done or if the specific url for the failed package install is due to the target git or URL. I apologise for my ignorance I don’t have much experience using Git.
[/quote]
I tried using restarting the system and it worked for me

[quote=“hamzaoy”, post:8, topic: 890115]
you must do the simple step:
1- create a new script and name it "ClientNetworkTransform "
2- past this script on ClientNetworkTransform =>

using Unity.Netcode.Components;
using UnityEngine;

namespace Unity.Multiplayer.Samples.Utilities.ClientAuthority
{
/// <summary>
/// Used for syncing a transform with client side changes. This includes host. Pure server as owner isn't supported by this. Please use NetworkTransform
/// for transforms that'll always be owned by the server.
/// </summary>
[DisallowMultipleComponent]
public class ClientNetworkTransform : NetworkTransform
{
/// <summary>
/// Used to determine who can write to this transform. Owner client only.
/// This imposes state to the server. This is putting trust on your clients. Make sure no security-sensitive features use this transform.
/// </summary>
protected override bool OnIsServerAuthoritative()
{
return false;
}
}
}

and it will work.
[/quote]

i used this and it works!! thank youu savior!!