Install a package from a Git URL
The Package Manager can load a package from a Git repository on a remote server.
Prerequisites
- Install the Git client (minimum version 2.14.0) on your computer.
- On Windows, add the Git executable path to the PATH system environment variable.
- If the target repository tracks files with Git LFS, install the Git LFS client on your computer.
- Read the information about using Git dependencies The 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 in your project.
Procedure
To load a package from a Git URL:
- Open the add
menu in the Package Manager’s toolbar . - The options for adding packages appear.

- Select Add package from git URL from the add menu. A text box and an Add button appear.
- Enter a valid Git URL in the text box and click Add. For more information about how to construct a valid Git URL, see Git URLs and extended syntax. Unity supports several Git protocols and some custom or extended syntax.

![]()
If Unity was able to install the package successfully, the package now appears in the package list with the label. If Unity wasn’t able to install the package, the Unity Console displays an error message, such as:
- No ‘git’ executable was found
- git-lfs: command not found
- Repository not found
- Could not read Username: terminal prompts disabled
Click on an error message link to get some help for it on the Troubleshooting page.
Tip: If you want to check for updates and update your Git dependency to the latest version from the repository, click Update. You can also use the Add package from git URL menu item to update your Git dependency. For information on Git dependencies, see Locked Git dependencies.
Unity и Git
Как настроить Unity для работы с Git? Как настроить Git, чтобы в репозиторий не попадали ненужные файлы?
Из всех файлов и папок в Unity проекте, нас интересует всего две папки: Assets и ProjectSettings. В первой папке хранятся все скрипты, спрайты, анимации и прочее. Во второй — настройки проекта. Все остальные файлы можно исключить из репозитория, их сгенерирует Unity, MonoDevelop или VisualStudio.
Добавим исключения в файл .gitignore
/[Ll]ibrary/ /[Tt]emp/ /[Oo]bj/ /[Bb]uild/ /[Bb]uilds/ /Assets/AssetStoreTools* # Autogenerated VS/MD solution and project files ExportedObj/ *.csproj *.unityproj *.sln *.suo *.tmp *.user *.userprefs *.pidb *.booproj *.svd # Unity3D generated meta files *.pidb.meta # Unity3D Generated File On Crash Reports sysinfo.txt # Builds *.apk *.unitypackage # OS generated .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes ehthumbs.db Thumbs.db
Кстати, на GitHub есть коллекция полезных .gitignore файлов, вроде, постоянно обновляется и пополняется.
Осталось настроить Unity:
- Устанавливаем Hidden Meta Files:
Editor → Project Settings → Editor → Version Control → Mode - Устанавливаем Force Text:
Editor → Project Settings → Editor → Asset Serialization → Mode - Сохраняем проект
Теперь можно запушить свой Unity проект. Также, можно поставить расширение Git LFS, оно позволяет работать с большими файлам, даже по несколько гигабайт.
Как подготовить проект Unity для git?
Какие обязательные шаги нужно предпринять, чтобы подготовить Unity-проект для отправки в репозиторий (git), например, на GitHub? Не хочется хранить ненужные файлы (особенно временные); также хотелось бы отправлять как можно меньше бинарных файлов. Перевод вопроса «How to prepare a Unity project for git?» @German.
Отслеживать
19k 6 6 золотых знаков 35 35 серебряных знаков 98 98 бронзовых знаков
задан 3 мая 2016 в 7:16
Nicolas Chabanovsky Nicolas Chabanovsky
51.2k 86 86 золотых знаков 266 266 серебряных знаков 505 505 бронзовых знаков
ассоциация: stackoverflow.com/questions/21573405
13 янв 2017 в 9:40
2 ответа 2
Сортировка: Сброс на вариант по умолчанию
Откройте свой проект в редакторе Unity и выполните следующие шаги:
- Выберите параметр External option в Unity → Preferences → Packages → Repository (только для версий Unity < 4.5)
- Используйте Visible Meta Files в Edit → Project Settings → Editor → Version Control Mode
- Используйте Force Text в Edit → Project Settings → Editor → Asset Serialization Mode
- Сохраните сцену и проект из меню File.
- Выйдите из Unity; вы можете удалить директории Library и Temp в директории проекта — можно удалять все, кроме директорий Assets и ProjectSettings.
Если вы уже создали новый пустой удаленный git-репозиторий (например, на GitHub), настало время отправить ваш код. Откройте командную строку и выполните следующие действия:
cd to/your/unity/project/folder git init git add * git commit -m "First commit" git remote add origin g[email protected]:username/project.git git push -u origin master
Теперь, удерживая Option или левую клавишу Alt, откройте свой Unity-проект. Это заставит Unity восстановить директорию Library (этот шаг может не понадобиться: я видел, как Unity восстанавливает директорию Library даже если вы не удерживали никакой клавиши).
Наконец, сделайте так, чтобы git игнорировал директории Library и Temp, то есть чтобы они не загрузались на сервер (добавьте их в файл .gitignore). Помните, что вы отправляете на удаленный сервер только директории Assets и ProjectSettings.
А вот мой личный «рецепт» .gitignore для Unity-проектов (я работаю на Macbook):
# =============== # # Unity generated # # =============== # Temp/ Obj/ UnityGenerated/ Library/ Assets/AssetStoreTools* # ===================================== # # Visual Studio / MonoDevelop generated # # ===================================== # ExportedObj/ *.svd *.userprefs *.csproj *.pidb *.suo *.sln *.user *.unityproj *.booproj # ============ # # OS generated # # ============ # .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db Thumbs.db
The GitHub Workflow with Git LFS and file locking support, all within Unity.
By downloading, you agree to the Terms and Conditions.

Free and open source
The extension is completely open source. Fix or report bugs. Build the features you need. Be a part of future GitHub for Unity releases.
Ditch the command line
View your project history, experiment in branches, craft a commit from your changes, and push your code to GitHub without leaving Unity.
Stay in sync with your team
Collaborate with other developers, pull down recent changes, and lock files to avoid troublesome merge conflicts.
Authentication and Initialization with GitHub
GitHub authentication is embedded in Unity, including 2FA.
And with a click of a button, you can quickly initialize your game’s repository.
Use the GitHub for Unity Extension
Get off of the command line and work exclusively within Unity by downloading and installing the GitHub package!
Reach out to the GitHub for Unity team
Do you have questions? Feature ideas? Just want to chat with the team? Reach out to us on GitHub by opening a new issue, or by joining one of the chats listed in the project README. You can also email us at unity@github.com, or tweet at @GitHubUnity
Code the GitHub for Unity Extension
Contribute to this open source project by reporting or resolving issues or forking the repository to add your own features!
© 2020 GitHub, Inc. All rights reserved.