winfsp / sshfs-win

SSHFS For Windows
https://winfsp.dev
Other
5.13k stars 260 forks source link

git init failed with Permission denied #53

Open dipucian opened 6 years ago

dipucian commented 6 years ago

I can map a network drive (Z:) and have read/write access to it, but when I try git init, it failed with error like: Z:/deployScript/.git/: Permission denied

image

where should I look? for these kind of problem.

Thanks

dipucian commented 6 years ago

I tried both \\sshfs\user@host and \\sshfs\windowsUser=user@host

pavelxkrejci commented 6 years ago
  1. If you run git from cygwin, try to start cygwin with elevated permissions as admin. Or try native windows build of git.
  2. Try to check permissions set for the user account on the ssh server. Does it work with different ssh client?
dipucian commented 6 years ago

I'm using native windows build, not running git from cygwin. And I have read write access to the folder with \sshfs, when I copy files into this folder on Windows, it appears to have the correct owner/group when I check on Linux side, so I think permissions for the Linux user is not a problem.

If I git init elsewhere and copy the .git folder into it, other git commands seems to work.

Chris

On Tue, Aug 14, 2018, 15:34 pavelxkrejci notifications@github.com wrote:

  1. If you run git from cygwin, try to start cygwin with elevated permissions as admin. Or try native windows build of git.
  2. Try to check permissions set for the user account on the ssh server. Does it work with different ssh client?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/billziss-gh/sshfs-win/issues/53#issuecomment-412781713, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxxEgmDgSIgvkcgGxPWyPhLpSH1Ji0pks5uQn2PgaJpZM4V7ptT .

pavelxkrejci commented 6 years ago

The problem may be that windows git tries to set hidden attribute on ".git" folder which is not available on Linux/ssh. The error message would be than more likely result of git internal logic and not directly related to sshfs. Edit: This is confirmed in Process Monitor all git filesystem operations result with success.

EKoetsjarjan commented 5 years ago

Hi @pavelxkrejci do you have any suggesition for a workaround? I have the same problem .

EKoetsjarjan commented 5 years ago

I just maybe found one, I have logged in to the linux box and created a git repository using git init inside the shared folder . then I opened the shared folder from windows and tried to commit/fetch changes, all worked well :)

pavelxkrejci commented 5 years ago

Easiest might be just "git init" in a local folder and then move the ".git" folder to the intended ssh folder.

holgerbrandl commented 5 years ago

This also is an issue when rendering reports with https://github.com/rstudio/rmarkdown which also created hidden directory (similar to the .git directory) and fails to run on directories mounted with sshfs-win

snaphat commented 5 years ago

Same problem with hg, but commits don't even work there.

maiormarso commented 4 years ago

Win10, right click on the [Git Bash] icon and select 'Run as Administrator'

Nabeel70 commented 4 years ago

Here is a simplest solution!! First show your hidden files of drives then open command-line By "Run as administrator"!!

smares commented 4 years ago

I am using TortoiseHg and cannot do anything because of permission denied errors for the .hg directory.

Edit: Obviously referring to Mercurial and not Git.

peterbelm commented 3 years ago

I've been tracking down this issue and it's a mixture of problems across three applications:

As you can see in the linked issue on sshfs I've submitted a patch that will check whether a directory is accessible if mkdir fails with EPERM, returning the correct EEXIST code if it is. With this patch I've been able to successfully clone a Git repo using sshfs-win.

harri-pasanen commented 2 years ago

Seems like the "git clone" would start working if sshfs was updated to v3.7.2, thanks to @peterbelm and https://github.com/libfuse/sshfs/issues/243 being closed.

Now the workaround is to do the initial clone at host and then doing git config core.autocrlf false git config core.filemode false on windows in the mapped directory.

ld0714 commented 2 years ago

I build the newest version and can solve it https://github.com/ld199607/sshfs-win