I am running an ssh-agent in the background and the PID env-variables are being set properly. For some reason Unity does not seem to pick up on this though.
This is in my .bashrc file, I’m starting it by opening the git bash on windows (Havent tested this on my mac yet):
While your script may successfully start the ssh-agent in the background, the exported environment variables are only available to the bash shell running the script and to any child process it launches from that point on; environment variables from parent processes, unrelated processes, or previously created child processes cannot be changed by your script. Further, even if the script is located in .bashrc, it only gets executed in bash shells. Launching programs (both in Windows and macOS) does not use a shell, so the script is not executed. On the other hand, if you open a bash shell first, then “manually” launch the Unity Editor from that shell, it should work.
In other words, if you use the script by running it once, then you launch Unity by double-clicking its icon or using the Hub, the Unity Editor process won’t have these variables set so ultimately the Git process invoked by Unity won’t have them either.
That said, I see a few possible workarounds.
You can create a bash script to launch the Unity executable or the Hub (caveat: the Hub must not already be running, otherwise that will just activate the existing process and it won’t have the newly exported environment variables)
Or since you’re on Windows, you might try to invoke SETX to permanently set the environment variables in the Windows registry. However you need to ensure the Hub process is not already running, or that it gets restarted if it’s already running. This solution would work best if you can ensure that the script runs once on startup and that the Hub is not started with Windows.
The last suggestion would have the benefit of seamlessly integrating the ssh-agent so it works as you expect it to.
@maximeb_unity hey thanks for the suggestion. The second one might just what i needed to also fix other ssh-agent related issues I’ve had with git clients (Tower, specifically). Will try this out asap! Cheers!
The important bit about gitlab is that their URLs tend to look like this: gitlab.com:company which gives you a hostname resolve error, so be sure to convert that : into a /.
Also: Unity Collaborate ignored the whole package folder which is great, since it previously didn’t when we just had the package with it’s .git folder in there.
Yeah, Gitlab provides SSH “URLs” in the SCP-like format, which is not quite a URL. We don’t support that format (yet) but we intend to because it will be easier - that format is commonly used in the Git world.
I think I have set everything up right. The git.exe path is in my System PATH variable. But still every time I try to start up the project, I get:
An error occurred while resolving packages:
Project has invalid dependencies:
com.harkogames.sportfun: No ‘git’ executable was found. Please install Git on your system and restart Unity
A re-import of the project may be required to fix the issue or a manual modification of E:/Unity Projects/MFE/Packages/manifest.json file.
Is there any way I can further troubleshoot why it isn’t finding the git.exe ?
I tried to use the file: scheme in Unity 2018.3.0f2. I made a bare git repository (No working directories) locally and can’t get it to be recognized. Here’s the line I’m putting into my Manifest.json "com.frl.versionit": "file:C:\\Test\\VersionIt.git",
The error says “file: Name or service not known fatal: Could not read from remote repository”
Screenshot of error message: https://imgur.com/tCgh0Km
A clone of the repo works fine: "com.frl.versionit": "file:C:\\Test\\VersionIt.gitClone",
The local git package scheme you use is not supported for the moment. For the meantime, you need to use this scheme file:///C:\\Test\\VersionIt.git (or file://localhost/C:\\Test\\VersionIt.git if you prefer the explicit form).
Project has invalid dependencies:
my-package: Version 'git@bitbucket.org:mycompany/my-package.git' is invalid. Expected a 'SemVer' compatible value or a value starting with 'file:', 'http:', 'https:', 'git:' or 'ssh:'.
Project has invalid dependencies:
my-package: Error when executing git command. ssh: Could not resolve hostname bitbucket.org:mycompany: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Even though I do have access rights (its a private repo on bitbucket, but i have ssh key for it). I know this because if I open command prompt and type git clone infront of it it works just fine
C:\Users\skjal>git clone git@bitbucket.org:mycompany/my-package.git
Cloning into 'my-package'...
This is tested on Unity 2018.3 and 2019.1.b02. What am I doing wrong? Is it the git url-parsing which is removing the last bit of the url?
edit; It worked when i changed it to git@bitbucket.org/mycompany/my-package.git (replacing the : with /)
@Skjalg You hit the other format that we don’t support at this time. For now, SCP and local file: scheme are not supported :(. Sorry about that. As you discovered, in the meantime, you can resort to the SSH scheme URL.
What’s the plan for package dependencies on assets published to the Asset Store. Will Unity ever support dependencies that reference git repos being published on the Asset Store? I saw you have to have git installed for it to work (makes sense.) Is the final package manager going to ship with some internal version of git, or is using git repos as dependencies only something to be used outside the context of the Asset Store?
That’s correct. At this time, we have no plans to allow packages to be published with dependencies other than on other packages from the registry. This is both a matter of security and stability.
Due to how Asset Store contents are imported in a project, and the lack of metadata about these contents, it’s currently impossible to know if a given Asset Store asset is present or not, or the version of that asset. The Asset Store package format will in time be migrated to the new format, so that it is possible to reference Asset Store contents from packages.
Makes sense. What’s the policy for having dependencies to official Unity packages? What about preview packages? I haven’t seen anything on the Asset Store that depends on Burst or Mathematics yet. I’ve been working on an asset for a long while that has the Mathematics and Burst packages as dependencies. I’m assuming I won’t even have a ability to publish the asset until the packages are out of preview?