What is wrong with my git 1.8.4.2-1?

2019-09-11 00:28发布

问题:

I have an old Synology DS-106j server where I tried to install git using ipkg command. The installation went smoothly, but git failed to work correctly. I am currently learning how to use git, so I don't know if it is a bug from git with the version I am using or something else is wrong.

What I did was create a new local repository with a specified name, add a new file, commit it, and got an error:

   NAS_SERVER> git init Test
   Initialized empty Git repository in /root/Test/.git/
   NAS_SERVER> ls
   Packages.gz                git_1.8.4.2-1_powerpc.ipk
   Test
   NAS_SERVER> cd Test
   NAS_SERVER> git status
   # On branch master
   #
   # Initial commit
   #
   nothing to commit (create/copy files and use "git add" to track)
   NAS_SERVER> touch Test.cs
   NAS_SERVER> ls
   Test.cs
   NAS_SERVER> git add *
   NAS_SERVER> git status
   # On branch master
   #
   # Initial commit
   #
   # Changes to be committed:
   #   (use "git rm --cached <file>..." to unstage)
   #
   #       new file:   Test.cs
   #
   NAS_SERVER> git commit -m "Test"
   fatal: 57e2b8c52efba71d84c56bf6f37581686b9061a3 is not a valid object

I thought...maybe I did something wrong, so I used git on Windows OS and try a push. Still an error. Transfer the whole repository to the server and check the status. It seems fine. Try a commit. Still the same result. What worse is that I can't update git version without having to compile it, which I don't even know how to do so. Any suggestion to what might be wrong?

回答1:

If your goal is to push into a git repo located on the synology disk(s) for backup purposes I'd recommend a different approach which would avoid having to install a rather old git version on the synology box itself (which could lead to problems if/when using a newer git version on the windows machine).

Export a samba share from synology, mount it on windows and use the windows git to create the backup repo (maybe even a bare repo, eventually group shared if you plan to share work with other people). Then push from your working repo into this backup repo - all on the windows box. In this scenario the synology box doesn't need git installed, it just serves files (i.e. its original job).

I'm using such setup but with a linux machine instead of a windows one and with the bare repo on the synology disks exported via NFS instead of Samba.



标签: linux git