Version: 2020.2
Installing a package from a local tarball file
Removing an installed package

Installing from a Git URL

The Package Manager can load a package from a Git repository on a remote server.

For more information about using Git URLs with the Unity Package Manager, see the documentation on using Git URLs in your project manifestEach Unity project has a project manifest, which acts as an entry point for the Package Manager. This file must be available in the <project>/Packages directory. The Package Manager uses it to configure many things, including a list of dependencies for that project, as well as any package repository to query for packages. More info
See in Glossary
.

To load a package from a Git URL:

  1. Click the add button in the status bar.

  2. The options for adding packages appear.

    Add package from git URL button
    Add package from git URL button
  3. Select Add package from git URL from the add menu. A text box and an Add button appear.

  4. Enter a valid Git URL in the text box and click Add.

Enter the Git URL and click Add

For more information about what protocols Unity supports, see Git dependenciesThe Package Manager retrieves Git dependencies from a Git repository directly rather than from a package registry. Git dependencies use a Git URL reference instead of a version, and there’s no guarantee about the package quality, stability, validity, or even whether the version stated in its package.json file respects Semantic Versioning rules with regards to officially published releases of this package. More info
See in Glossary
.

If Unity was able to install the package successfully, the package now appears in the package list with the git tag.

If Unity was not able to install the package, the Unity Console displays an error message. For more information, see if you can find the message in the list of Error messages below.

Error messages

Repository not found

If you specify a location that does not exist, a message similar to this one appears in the Unity Console:

Cannot perform upm operation: Unable to add package [https://mycompany.github.com/gitproject/com.mycompany.mypackage.git]:
  Error when executing git command. fatal: repository 'https://mycompany.github.com/gitproject/com.mycompany.mypackage.git/' not found
 [NotFound]
UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:310)

Check your spelling. To make sure you are using the correct URL, go to the repository’s page and copy the URL from the Clone button:

Where to copy the URL on GitHub (A) and GitLab (B)
Where to copy the URL on GitHub (A) and GitLab (B)

Click the button to the right of the URL on GitHub (A) or GitLab (B) to copy the URL to your clipboard.

Could not read Username: terminal prompts disabled

If you are trying to install a package from a private repository that requires authentication, a message similar to this one appears in the Unity Console:

Cannot perform upm operation: Unable to add package [https://mycompany.github.com/gitproject/com.mycompany.mypackage.git]:
  Error when executing git command. fatal: could not read Username for 'https://mycompany.github.com': terminal prompts disabled
 [NotFound]
UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:310)

The two most common protocols for authentication while cloning or fetching Git repositories are HTTP(S) and SSH (that is, a pair of public and private SSH keys):

  • With HTTP(S), every time you log onto GitHub or GitLab you need to enter your username and password in a terminal or a dialog box.

  • With SSH, you can add your public SSH key to GitHub or GitLab and then access repositories without having to enter a username and password.

    However, if you have set up a passphrase to keep your SSH key safe, you still have to enter that passphrase in a terminal or a dialog box in order to authorize your key.

For an overview of the difference between the protocols that Git uses, see the Git documentation for using protocols.

The Package Manager does not provide an interactive terminal or dialog where you can enter your username and password for HTTP, or your passphrase to unlock your SSH key. To bypass this, use one of these workarounds:

  • Use a credential manager (Git Credential Manager for Windows or OSXKeyChain).
  • Use git-credentials from a terminal or command prompt. Then launch the Hub from the same terminal so that Unity has access to the cached or stored credentials.
  • Use ssh-agent running in the background from a terminal or command prompt, and provide the process ID to GitHub or GitLab.


Installing a package from a local tarball file
Removing an installed package
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961