Sharing a Git repository between Windows and Linux

To develop php projects I use Netbeans IDE. Ihave the version 8.2 in the WIndows partition and the version 8.1 in the Linux partition (this is the version provided by the official Software Manager).
From Windows I have setup a git repository hosted in BitBucket: first I have created the repo in BitBucket, then I have initialized a Git repo in Netbeans and I have committed and pushed the whole project.
Then, in Linux, I have cloned the repo in Netbeans providing the url of the repo. Everything went fine: I performed commit and push from Windows, then from Linux, then from WIndows again.
The last time I tried to commit from Linux I've got an error about a corrupted object. Some investigation made me realize that the object was an avi file that for reasons I ignore had been copied in the repo (I had moved some video from another external hard drive to the one where even my project is stored: all files have been copied in the right directory but one of them, and only one, has been copied even in the repo!!).
As explained here, I tried to delete the file and finally I did it, unless it was just a ghost-file or someone put some drug in my drink :)

Once deleted the corrupted object I thought everything was fine, but Git still give me an error about another corrupted object, and this time is not a video, is an empty folder (

So I suspect there is something I'm missing about sharing a repo between Windows and Linux, maybe is just an issue with Netbeans.

Any idea?
Thank you.
LVL 32
Marco GasiFreelancerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Britt ThompsonSr. Systems EngineerCommented:
I share repos between Linux and Windows regularly and the only thing I run into is issues with different line endings but git just warns about that. You may run into issues if you're using characters in file names that unsupported in Windows or extremely long file paths -

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)

Also, check for leading or hanging spaces on file names. If that's not it, see what happens when you use Git outside of your IDE.
0
Marco GasiFreelancerAuthor Commented:
Thank you Britt for your answer. It just tell me that my problems is not related to sharing the repo and my suspects were wrong :)
I don't have terribly long paths, nor special chars in file names, nothing strange.
git fsck

Open in new window

gives me this output, now:
git fsck
error: object file .git/objects/31/51f5c64bb5fcd17c8f339c827bccd3151343dd is empty
error: object file .git/objects/31/51f5c64bb5fcd17c8f339c827bccd3151343dd is empty
fatal: loose object 3151f5c64bb5fcd17c8f339c827bccd3151343dd (stored in .git/objects/31/51f5c64bb5fcd17c8f339c827bccd3151343dd) is corrupt

Open in new window

And git-repair gives this:
git-repair
Running git fsck ...
git-repair: /media/marco/WD Elements/Dev/htdocs/wit_CLIENTI/bcfolder_frontend_crazy_wit/.git/objects/31/51f5c64bb5fcd17c8f339c827bccd3151343dd: removeLink: inappropriate type (Is a directory)

Open in new window

The empty folder is not removed, trying to remove using command line or file manager gives me error that it doesn't exist and I'm sure that if I look for that from Windows I'll see it really doesn't exist.

I fear I'll have to initialize a new repo...
0
Britt ThompsonSr. Systems EngineerCommented:
Check this article where someone had, what appears to be, an identical issue. This person was able to resolve it -

https://stackoverflow.com/questions/11706215/how-to-fix-git-error-object-file-is-empty
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Marco GasiFreelancerAuthor Commented:
Hey Britt, I read that article but the main issue is that nor Linux nor Windows nor a live distro allow me to delete or move the whole repo: currently I still have 4 folders in .git directory and I can't delete them because  any OS tells me that the directory doesn't exist. This prevent me even to create a new repo (I should  copy source code to another folder and restart from there but it's irritating I can't delete something and even that OS show me something which doesn't exist :D
0
nociSoftware EngineerCommented:
What probably happened is that a directory got corrupted.. (somehow)...
I am not sure what the filesystems is.... (NTFS, FAT, ext2)... drivers for both operating systems exist and some may not have the same info as the other.

NTFS - Windows NT Native filesystem, with a reasonable usermode filesystem for Linux.
FAT - There used to be a GOOD FAT (ExFat) filesystem for linux, alas, microsoft sued companies for patent infringement (and extorted money out of them) and Linux FAT isn't completely compatible with Windows NT Fat.... (FAT 12, FAT16 & FAT32 (partly)) is. AFAIK Microsoft receives about $15,-- for each linux that has FAT support (like Android).  So they probably earn more on sold phones then they earn on windows.
The main problem is the OS developers have no definite idea what the patent infringement is about (AFAICT) so a good work around still is tricky.  (It has probably to do with the way filenames are treated, but the deals are all sealed under NDA's).
Also Linux doesn't keep a seconds FAT up to date due to probably the same patent issue.
Ext2FS  is a Linux filesystem, but does have Windows Drivers. Not sure if they also can handel Ext4 with journaling...

My guess is that your filesystem is FAT..
A filesystem level FSCK might help repair things. (Although you may loose files with it.) That fact that after you use the disk in wndows that the name doesn;t show does indicate this. (In ExFAT filenames are stored with: 8.3 Names in capitals, and the lowercase name is stored as extra characters in the FCB's  after the 8.3 name (In Extra headers, as many as needed)..   So if the original 8.3 name is gone, but the lower case is still shown the file is Actualy missing, except that parts of it are still there.  (This mostly should not be a problem).

Either try a  CHKDSK/F from windows or try a fsck -f from linux to repair it.

The mentioning of the use under windows made me think about this. So it is quite important information.
This might have happened when a disk got disconnected, or a system powered down without proper dismount.
(And might be caused by a accidental collision in the FAT tables).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Marco GasiFreelancerAuthor Commented:
This might have happened when a disk got disconnected, or a system powered down without proper dismount

Yeah, that's the point. Every time I connect an additional external drive the one which is always connected is unmounted and remounted (and if I forget to close the project in Netbeans, it automatically starts to delete file from the server).

So probably this is what happened and this is the lesson for the future:

always close everything before to mount another device

Thank you both
0
Marco GasiFreelancerAuthor Commented:
Thank you both. A valid lesson for the future.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.