-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
erepo: ignores ssh-agent keys in windows git-bash #7702
Comments
Following up: the data pulled in |
@piotlinski Thanks for the report. Could you share a little more traceback detail from |
@daavoo Sure, here is the output of **Click to show spoiler**
btw. calling |
This comment was marked as resolved.
This comment was marked as resolved.
This is not the same issue. #7670 is due to git credential storage being unsupported. This looks like a problem with asyncssh support for ssh-agent on windows. @piotlinski what shell are you using in windows? edit: I see this is in github actions, I'm not sure how GHA translates unix style paths in actions (like |
@pmrowla I did try with a dedicated action for setting up ssh-agent: https://github.com/webfactory/ssh-agent (I supposed it should handle every OS available @ GitHub Actions properly), but the error occurred as well. With previous DVC versions we did not have any issues with the approach presented above. |
Meant that because 2.10 is the version that introduced the issue appears to be related to adopting |
@daavoo Yes, adopting |
Hi @mdekstrand . @dtrifiro is working on adding support for credential helpers in dulwich, see #7307 (comment) :) |
@daavoo Yep, seeing that issue is how I knew the HTTPS side was a dulwich problem. At least until that PR lands in a published release, could |
The only way (disclaimer: it's hacky 😅 ) I can think of achieving this without requiring a new release (either dvc, scmrepo or dulwich) would be for you to edit your local I think it might be better to wait for the release or downgrade dvc
I think having the ability to select a git backend would be a valid feature request for scmrepo. However, I believe that the current direction in DVC is to focus on using/supporting only |
This comment was marked as off-topic.
This comment was marked as off-topic.
@dtrifiro Any thoughts? |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@dtrifiro why closing the issue? Unfortunately the problem is not resolved - on latest version (2.27.2) the problem still exists in GitHub Actions, as described in the original posts. I attach the logs below: click to expand logs2022-09-27 10:24:38,151 DEBUG: Creating external repo git@github.com:***/project-benchmarks.git@270d169b792ed8a8e02ef859dd80ae47b7febd18
2022-09-27 10:24:38,151 DEBUG: erepo: git clone 'git@github.com:***/project-benchmarks.git' to a temporary dir
2022-09-27 10:24:40,356 ERROR: failed to pull data from the cloud - Failed to clone repo 'git@github.com:***/project-benchmarks.git' to 'C:\Users\RUNNER~1\AppData\Local\Temp\tmpltcso3mudvc-clone'
------------------------------------------------------------
Traceback (most recent call last):
File "D:\a\project\project\.venv\lib\site-packages\scmrepo\git\backend\dulwich\__init__.py", line 200, in clone
repo = clone_from()
File "D:\a\project\project\.venv\lib\site-packages\dulwich\porcelain.py", line 538, in clone
return client.clone(
File "D:\a\project\project\.venv\lib\site-packages\dulwich\client.py", line 760, in clone
result = self.fetch(path, target, progress=progress, depth=depth)
File "D:\a\project\project\.venv\lib\site-packages\dulwich\client.py", line 837, in fetch
result = self.fetch_pack(
File "D:\a\project\project\.venv\lib\site-packages\dulwich\client.py", line 1146, in fetch_pack
proto, can_read, stderr = self._connect(b"upload-pack", path)
File "D:\a\project\project\.venv\lib\site-packages\dulwich\client.py", line 1792, in _connect
con = self.ssh_vendor.run_command(
File "D:\a\project\project\.venv\lib\site-packages\fsspec\asyn.py", line 111, in wrapper
return sync(self.loop, func, *args, **kwargs)
File "D:\a\project\project\.venv\lib\site-packages\fsspec\asyn.py", line 96, in sync
raise return_result
File "D:\a\project\project\.venv\lib\site-packages\fsspec\asyn.py", line 53, in _runner
result[0] = await coro
File "D:\a\project\project\.venv\lib\site-packages\scmrepo\git\backend\dulwich\asyncssh_vendor.py", line 163, in _run_command
conn = await asyncssh.connect(
File "D:\a\project\project\.venv\lib\site-packages\asyncssh\connection.py", line 7834, in connect
return await asyncio.wait_for(
File "C:\hostedtoolcache\windows\Python\3.10.4\x64\lib\asyncio\tasks.py", line 408, in wait_for
return await fut
File "D:\a\project\project\.venv\lib\site-packages\asyncssh\connection.py", line 447, in _connect
await options.waiter
asyncssh.misc.PermissionDenied: Permission denied
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
2022-09-27 10:24:40,372 DEBUG: Analytics is disabled.
File "D:\a\project\project\.venv\lib\site-packages\dvc\scm.py", line 145, in clone
git = Git.clone(url, to_path, progress=pbar.update_git, **kwargs)
File "D:\a\project\project\.venv\lib\site-packages\scmrepo\git\__init__.py", line 143, in clone
backend.clone(url, to_path, **kwargs)
File "D:\a\project\project\.venv\lib\site-packages\scmrepo\git\backend\dulwich\__init__.py", line 203, in clone
raise CloneError(url, to_path) from exc
scmrepo.exceptions.CloneError: Failed to clone repo 'git@github.com:***/project-benchmarks.git' to 'C:\Users\RUNNER~1\AppData\Local\Temp\tmpltcso3mudvc-clone'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\a\project\project\.venv\lib\site-packages\dvc\commands\data_sync.py", line 31, in run
stats = self.repo.pull(
File "D:\a\project\project\.venv\lib\site-packages\dvc\repo\__init__.py", line 49, in wrapper
return f(repo, *args, **kwargs)
File "D:\a\project\project\.venv\lib\site-packages\dvc\repo\pull.py", line 34, in pull
processed_files_count = self.fetch(
File "D:\a\project\project\.venv\lib\site-packages\dvc\repo\__init__.py", line 49, in wrapper
return f(repo, *args, **kwargs)
File "D:\a\project\project\.venv\lib\site-packages\dvc\repo\fetch.py", line 82, in fetch
used = self.used_objs(
File "D:\a\project\project\.venv\lib\site-packages\dvc\repo\__init__.py", line 430, in used_objs
for odb, objs in self.index.used_objs(
File "D:\a\project\project\.venv\lib\site-packages\dvc\repo\index.py", line 233, in used_objs
for odb, objs in stage.get_used_objs(
File "D:\a\project\project\.venv\lib\site-packages\dvc\stage\__init__.py", line 689, in get_used_objs
for odb, objs in out.get_used_objs(*args, **kwargs).items():
File "D:\a\project\project\.venv\lib\site-packages\dvc\output.py", line 1034, in get_used_objs
return self.get_used_external(**kwargs)
File "D:\a\project\project\.venv\lib\site-packages\dvc\output.py", line 1089, in get_used_external
return dep.get_used_objs(**kwargs)
File "D:\a\project\project\.venv\lib\site-packages\dvc\dependency\repo.py", line 97, in get_used_objs
used, _ = self._get_used_and_obj(**kwargs)
File "D:\a\project\project\.venv\lib\site-packages\dvc\dependency\repo.py", line 111, in _get_used_and_obj
with self._make_repo(locked=locked, cache_dir=local_odb.path) as repo:
File "C:\hostedtoolcache\windows\Python\3.10.4\x64\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "D:\a\project\project\.venv\lib\site-packages\dvc\external_repo.py", line 39, in external_repo
path = _cached_clone(url, rev, for_write=for_write)
File "D:\a\project\project\.venv\lib\site-packages\dvc\external_repo.py", line 169, in _cached_clone
clone_path, shallow = _clone_default_branch(url, rev, for_write=for_write)
File "D:\a\project\project\.venv\lib\site-packages\funcy\decorators.py", line 45, in wrapper
return deco(call, *dargs, **dkwargs)
File "D:\a\project\project\.venv\lib\site-packages\funcy\flow.py", line 274, in wrap_with
return call()
File "D:\a\project\project\.venv\lib\site-packages\funcy\decorators.py", line 66, in __call__
return self._func(*self._args, **self._kwargs)
File "D:\a\project\project\.venv\lib\site-packages\dvc\external_repo.py", line 239, in _clone_default_branch
git = clone(url, clone_path)
File "D:\a\project\project\.venv\lib\site-packages\dvc\scm.py", line 150, in clone
raise CloneError(str(exc))
dvc.scm.CloneError: Failed to clone repo 'git@github.com:***/project-benchmarks.git' to 'C:\Users\RUNNER~1\AppData\Local\Temp\tmpltcso3mudvc-clone' btw. version 2.9.5 works perfectly fine in the same setup. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@piotlinski The github actions snippet you posted does not seem to be working, this is the error I'm getting on gha when running your code: Run ssh-agent -a $SSH_AUTH_SOCK > /dev/null # breaks here
ssh-agent -a $SSH_AUTH_SOCK > /dev/null # breaks here
ssh-keygen -t ed25519 -N dummy -f key_ed25519 # creating a new key
ssh-add key_ed25519 #
mkdir -p ~/.ssh/
ssh-keyscan -H github.com > ~/.ssh/known_hosts
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
Out-File: D:\a\_temp\1dfe347a-6052-440e-ac06-4369f0d0a4ce.ps1:2
Line |
2 | ssh-agent -a $SSH_AUTH_SOCK > /dev/null # breaks here
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Could not find a part of the path 'D:\dev\null'. which makes sense to me, since it's trying to access |
Sorry, forgot to include one part:
You need to be running this in bash and not powershell |
It looks like this is specific to git-bash/mingw openssh (which is what is used when you specify As far as I can tell, the problem is that the asyncssh windows agent implementation expects that it will be used with a windows pipe (i.e. UNC path I'm guessing that this would actually work out of the box if you were using a mingw python build, but the problem here happens because we end up mixing a native windows python build inside a mingw shell environment. The fix is probably for us to just check for mingw environment vars when we are in windows and then fallback to the subprocess |
@pmrowla Great research! 🔥 |
Bug Report
pull: ignores ssh-agent keys
Description
DVC 2.10.0 stops using ssh-agent (passed via
SSH_AUTH_SOCK
variable) for git clone operation resulting inPermission denied
error.Reproduce
Expected
Artefacts are downloaded as in <=2.9.5 version
Environment information
GitHub Actions
The text was updated successfully, but these errors were encountered: