I can successfully connect to a remote server using oil-ssh but ...
Did you check the docs and existing issues?
- [X] I have read the docs
- [X] I have searched the existing issues
Neovim version (nvim -v)
NVIM v0.10.1
Operating system/version
Ubuntu 16.04
Describe the bug
I can without any problem connect to a remote server using oil-ssh, but when i try to open and edit a file, i'm getting this error displayed on the buffer :
ssh: Could not resolve hostname scp: Name or service not known
To connect to the remove server at the beginning i was using a password, but after that i used my ssh key to connect to the remote server without having to type my password everytime, but the problem is the same in both cases.
When trying to connect and using a regular vim it works.
When i tried to reproduce the issue with the lua provided on the bug report form, looks like that the oil-ssh command was not available.
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
- Run : nvim oil-ssh://Username@IP/
- Select a file and type enter to edit it
- See the error message : "ssh: Could not resolve hostname scp: Name or service not known"
Expected Behavior
I was expecting to have the selected file to be opened and displayed on the buffer
Directory structure
No response
Repro
-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"stevearc/oil.nvim",
config = function()
require("oil").setup({
-- add any needed settings here
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Did you check the bug with a clean config?
- [X] I have confirmed that the bug reproduces with
nvim -u repro.luausing the repro.lua file above.
It sounds like scp is having some trouble with the command used to download the remote file. Hard to say what that could be without seeing it. Could you update oil.nvim and try again? I just pushed a change that will include the raw scp command in the error output so we will have more to work with.
It sounds like scp is having some trouble with the command used to download the remote file. Hard to say what that could be without seeing it. Could you update oil.nvim and try again? I just pushed a change that will include the raw
scpcommand in the error output so we will have more to work with.
Hello here is the error that i'm getting :
Error running command 'scp -C scp://[email protected]/%2Fhome%2Fxxxxxx%2Fmain.yml /tmp/.repro//cache/nvim/oil/ssh_ZjKoqY'
I just hide the my user name with xxxxxx and the IP address is a fake one even if it's a local one, all the rest is from the original error displayed.
So i guess is enough information to confirm the issue ?
Oh wow I just noticed that you're on a super old version of Ubuntu. That's probably going to have something to do with it, but we can probably get it working. The issue right now is that the scp command is throwing an error. It works with my version of scp, so I can't directly debug. Can you:
- try running that scp command directly in your shell to see if it produces the same error?
- if so, can you try to use the man pages for your version to come up with an invocation that does work? I suspect that the issue might be that your version doesn't support the
-Cargument.
Oh wow I just noticed that you're on a super old version of Ubuntu. That's probably going to have something to do with it, but we can probably get it working. The issue right now is that the
scpcommand is throwing an error. It works with my version of scp, so I can't directly debug. Can you:
- try running that scp command directly in your shell to see if it produces the same error?
- if so, can you try to use the man pages for your version to come up with an invocation that does work? I suspect that the issue might be that your version doesn't support the
-Cargument.
So this is not working :
- scp -C scp://[email protected]/%2Fhome%2Fxxxxxx%2Fmain.yml /tmp/.repro//cache/nvim/oil/ssh_ZjKoqY
- scp -C scp://[email protected]:/%2Fhome%2Fxxxxxx%2Fmain.yml /tmp/.repro//cache/nvim/oil/ssh_ZjKoqY
- scp -C [email protected]/%2Fhome%2Fxxxxxx%2Fmain.yml /tmp/.repro//cache/nvim/oil/ssh_ZjKoqY
- scp -C [email protected]//home/xxxxxx/main.yml /tmp/.repro//cache/nvim/oil/ssh_ZjKoqY
- scp -C [email protected]/home/xxxxxx/main.yml /tmp/.repro//cache/nvim/oil/ssh_ZjKoqY
To make it work i had to make it like that (and this is how i usually use scp, but i might probably be use to it like that because of this old system): scp -C [email protected]:/home/xxxxxx/main.yml /tmp/.repro//cache/nvim/oil/ssh_ZjKoqY
So looks like it doesn't like the "%2F" and the "scp://" prefix in front of the username, and i need to add this ":" character just after the IP address.
So on your end you run scp with something like that and it works ? scp -C scp://[email protected]//home/xxxxxx/main.yml /tmp/.repro//cache/nvim/oil/ssh_ZjKoqY
Yes, it looks like the URI format for scp targets was added in OpenSSH 7.7, which was released on April 1 2018. Is there...any way you can upgrade to a newer version of OpenSSH?
@stevearc Hello! I have the exact same issue except I checked using man scp and both my local and remote devices do have -C flag and they have versions 9 point something
And yes, the same command reformatted using @EmmaLa algorithm downloaded file just right
Just Checked: if I run the command locally, it works just fine, but from neovim it can't