git-lfs / git-lfs

Git extension for versioning large files
https://git-lfs.com
Other
12.93k stars 2.03k forks source link

Integrating Git LFS with TeamCity issue (port 443: connectex: no connection could be made) #885

Open abc-moviestarplanet opened 8 years ago

abc-moviestarplanet commented 8 years ago

I am having an issue trying to integrate Git LFS with TeamCity, using SSH key-based authentication.

Cloning and fetching works fine, but during checkout, it fails on the first LFS tracked file. I attached the LFS log here: git-lfs.txt

The point of interest: Post https://<github-enterprise>/<organization>/<repo>.git/info/lfs/objects/batch: dial tcp 10.0.0.202:443: connectex: No connection could be made because the target machine actively refused it.

Now we do not have any SSL set up, so we want to use HTTP. When I try to clone the repository manually through cmd (on the TeamCity agent), everything works fine. The git lfs env also shows the same values, as seen here: git_lfs_env.txt

I cannot see any difference except that the TeamCity agent is running under the Local System user.

I also had to create a .gitconfig file in the path C:\Windows\System32\config\systemprofile\ for git LFS to automatically trigger during checkout (instead of running git lfs pull later in the build steps), with the following content:

[filter "lfs"]
   clean = git-lfs clean %f
   smudge = git-lfs smudge %f
   required = true

Any ideas what could be going wrong, or what else to check?

Currently I work around this by using HTTP instead of SSH, and hardcoding the username/password in the .lfsconfig in the repository but would like to avoid doing this.

shuhrat commented 8 years ago

in your VCS Root configuration use ssh protocol git@github-enterprise:owner/repo.git

shuhrat commented 8 years ago

one more hack: with turned smudge on checkout will be loooong) so in your build agent configuration turn it off smudge = git-lfs smudge --skip %f and create command line buildstep with commands git lfs fetch && git lfs checkout

technoweenie commented 8 years ago

@msp-abc: It sounds like you're running github enterprise with SSH, but no SSL or HTTPS. That error message indicates it's trying to connect to an HTTPS port. Without HTTPS being enabled, that shouldn't work. So that indicates an issue with github enterprise. Can you send details to GitHub Enterprise support so I can see what version and config you're running so I can investigate? It doesn't sound like this is a git-lfs client issue.

You also mentioned setting up the lfs config in C:\Windows\System32\config\systemprofile\. The git lfs install command currently adds to your global git config, which is stored in your user home directory. This means it won't work for other users on the same system. We've talked in chat about changing this to default to the system config instead, with flags for specifying where you want the config explicitly (--system, --global, --local).

@shuhrat: you can call git lfs pull instead of fetch + checkout :)

abc-moviestarplanet commented 8 years ago

Thanks for the replies!

@shuhrat the VCS root configuration was set correctly. Why would smudge on checkout take longer than doing a git pull later? I will give it a try.

@technoweenie I have already sent a request to GitHub Enterprise support (request 26884). Does that suffice? Re: git lfs install, yes, it would make sense to be able to specify whether to install it for the current or system user.

technoweenie commented 8 years ago

Why would smudge on checkout take longer than doing a git pull later? I will give it a try.

Git calls smudge filters for each individual file in serial, which can be inefficient for repositories with lots of LFS objects. Going with @shuhrat's suggestion requires an extra git lfs pull command, but this command is able to fetch the objects in parallel much faster.

I have already sent a request to GitHub Enterprise support (request 26884). Does that suffice?

Yup. Curious why no one pinged me on it :) I'll look into it.

adityayuwono commented 8 years ago

@shuhrat i have tried implementing your workaround, but still find this error

Failed to perform checkout on agent: '"c:\program files\git\bin\git.exe" checkout -q -f master' command failed.
stderr: Downloading Assets/CustomAsset/Scripts/Editor/LabsterEditorTools/Resources/Gizmos/Green.png (4.73 KB)
Error accessing media: Assets/CustomAsset/Scripts/Editor/LabsterEditorTools/Resources/Gizmos/Green.png (731502e4ed000aae229aef2bcdeb3a6472d66b5ec7f2cee0d3f9256ceadf18c8)

Errors logged to .git\lfs\objects\logs\20160112T232528.7179394.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge %f failed 2
error: external filter git-lfs smudge %f failed
fatal: Assets/CustomAsset/Scripts/Editor/LabsterEditorTools/Resources/Gizmos/Green.png: smudge filter lfs failed
shuhrat commented 8 years ago

@adityayuwono in order to help you I should know what is in your configurations

  1. what is in .gitconfig file on your agent?
  2. run git lfs env, add one command line step in Build Steps of your build configuration just add command
  3. is your git-lfs client on agent is latest?
  4. in your repos url are you using ssh protocol? notice that ssh+git won't work
kjgorman commented 7 years ago

hey @adityayuwono -- aware I'm reviving a relatively old issue here, but just ran into the same issue at my work. inspecting the log on our agent we had a bad credential error; turns out someone had (inadvertently) removed the access token we were using for auth; I just had to regenerate the token and reset the VCS password configuration.

ttaylorr commented 6 years ago

Hi all, I am going to close this thread, since it has been inactive for quite some time. I'm assuming that the underlying issue has been resolved or addressed in one of the many Git LFS releases since this was originally opened, but if this isn't the case, please do let me know and I would be happy to take a look into again sometime in the near future. Thanks!