Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push error on git repo hosted on a Windows shared folder from Linux

Tags:

I've seen this question on SE, this other question on SuperUser and this question on AskUbuntu, but they seem to side step my situation.

I have a shared folder hosted on windows. I've created a git repo (with --bare option) there to kick off a project.

On a local folder with windows, I've managed to clone the repo with: git clone \\<ip address>\shared_folder_name\name_of_folder_with_git_repo

And I'm able to push normally.

Then on linux, I've cloned it successfully with:

git clone ~/.gvfs/smb-share:server=<ip address>,share=shared_folder_name/name_of_folder_with_git_repo

Looks great, but I cannot push from linux. The erro message shown is:

remote: error: object directory /home/my_username/.gvfs/smb-share does not exist; check .git/objects/info/alternates.
remote: error: object directory server=<ip address>,share=shared_folder_name/name_of_folder_with_git_repo does not exist; check .git/objects/info/alternates.
remote: error: object directory /home/my_username/.gvfs/smb-share does not exist; check .git/objects/info/alternates.
remote: error: object directory server=<ip address>,share=shared_folder_name/name_of_folder_with_git_repo does not exist; check .git/objects/info/alternates.
remote: error: object directory refs/heads/master does not point to a valid object!
remote: fatal: bad object HEAD
error: object directory /home/my_username/.gvfs/smb-share does not exist; check .git/objects/info/alternates.
error: object directory server=<ip address>,share=shared_folder_name/name_of_folder_with_git_repo does not exist; check .git/objects/info/alternates.
error: object directory refs/heads/master does not point to a valid object!
fatal: bad object HEAD
To /home/my_username/.gvfs/smb-share:server=<ip address>,share=shared_folder_name/name_of_folder_with_git_repo
! [remote rejected] master -> master (missing necessary objects)
error: failed to push some refs to '/home/my_username/.gvfs/smb-share:server=<ip address>,share=shared_folder_name/name_of_folder_with_git_repo'

In the remote repository, .git/objects/info/ is an empty folder.

I've tried adding different remotes, but to no avail. I was hoping the lack of an smb helper would not be a concern, otherwise I would not have been able to clone.

I need to find a method to be able to push relatively normally to the repo on this shared folder, preferably without requiring repeated usage of sudo.

like image 582
Mefitico Avatar asked Aug 12 '20 18:08

Mefitico


1 Answers

I would not, in general, use the gvfs-fuse functionality to host or clone a repository. It has provided some odd, non-POSIX behavior in the past, and something about it is causing the failure here. It may be fine for transferring a few files via MTP to an Android phone, but it is not robust enough for things like Git that have serious file system consistency requirements.

You are better off using the cifs file system built into Linux (as described in the AskUbuntu answer you linked) or hosting an SSH server on the Windows machine and pushing that way.

Note that it isn't FUSE file systems that are problematic, but gvfs-fuse specifically; sshfs works great for this purpose and is very robust.

like image 164
bk2204 Avatar answered Oct 11 '22 18:10

bk2204