1

I have a slightly complex issue that can be split across two work environments:

  1. My Windows 10 work computer
  2. A Linux server, accessible via SSH, VNC and networked SAMBA drive using a VPN

There are two git repos on the server:

  1. An archived, shared repo, located at //xxx.xxx.xxx.xxx/repos/git-matlab/
  2. My personal repo, located at //xxx.xxx.xxx.xxx/my-username/repos/personal-repo/

I have set up my SSH keys on both systems (they are present in ~/.ssh).

I have been able to push, pull and clone to personal-repo from my Windows machine without any issues.

When attempting to clone to git-matlab from my Windows machine, I get the following error:

$ git clone --branch=main //xxx.xxx.xxx.xxx/repos/git-matlab/
Cloning into 'git-matlab'...
error: refs/heads/main does not point to a valid object!
fatal: Remote branch main not found in upstream origin

When attempting to clone to git-matlab from personal Linux environment on the server using PuTTY, I get a large error. Output is summarised as follows:

$ git clone --branch=main /home/repos/git-matlab/

...

warning: failed to stat /home/repos/git-matlab/.git/objects/a5/1396ecd11cf0fd93cedd0dff1deda885508e3d

warning: failed to stat /home/repos/git-matlab/.git/objects/a5/f60d21cf9955ab0b6c82c12fefaa9e1f51dfc0

warning: failed to stat /home/repos/git-matlab/.git/objects/f3/.

warning: failed to stat /home/repos/git-matlab/.git/objects/f3/..

warning: failed to stat /home/repos/git-matlab/.git/objects/f3/4fd030aeee62a14e915e1fe06d2a7a22e2595e

warning: failed to stat /home/repos/git-matlab/.git/objects/f9/.

warning: failed to stat /home/repos/git-matlab/.git/objects/f9/..

warning: failed to stat /home/repos/git-matlab/.git/objects/f9/7e571b07827b8e32be70c38191cae18e3295b9

done.

A git-matlab folder with a .git directory inside does get outputted but that's it.

I should add that these are both shared repos. I also have permissions to view the git-matlab directory via Windows Explorer and Nautilus (Linux file explorer).

Any help or insight would be hugely appreciated. Thanks in advance.

james12
  • 11
  • 2
  • Your Git repo `//xxx.xxx.xxx.xxx/repos/git-matlab/` seems to be a SAMBA share. In this case SSH keys are not relevant to using Git. I don't know if Git can correctly handle concurrent access to a shared repo in this setup. You might also run into problems when both Git clients running on Linux and those running on Windows access the same repo. I recommend to set up a proper Git server with SSH access. Please [edit] your question and show a non-recursive directory listing of `//xxx.xxx.xxx.xxx/repos/git-matlab/` and `/home/repos/git-matlab/.git/` Show the exact command you used on Linux. – Bodo Mar 16 '21 at 11:45
  • It is a SAMBA drive, yes. It's just wierd that I'm able to clone to and interact with 'personal-repo' from my Windows machine if that's on the same server. Thanks for your other comments - I'll certainly be keeping those in mind. I made the edits as requested. – james12 Mar 16 '21 at 12:52
  • The warnings `warning: failed to stat /home/repos/git-matlab/.git/objects/...` might result from another process modifying the repository at the same time. I don't know if Git can handle this when using a shared folder. This may depend on the network protocol used for sharing the data. Just another remark: For a shared repository you should use a bare repository which would normally have Git's internal files in `/home/repos/git-matlab.git/` instead of `/home/repos/git-matlab/.git/`. – Bodo Mar 16 '21 at 13:54

1 Answers1

0

First, make sure to use the latest Git For Windows, considering the support for UNC path was improved in Q4 2019.

Second, if the server is accessible through SSH, then try that protocol

git clone ssh://remoteUSer@xxx.xxx.xxx.xxx/full/path/to/repo
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for your answer. Sadly, I get the exact same error after authenticating with my password – james12 Mar 18 '21 at 09:08