1

I am using Eclipse 2021-12 with EGit on a MacBook and created a local repo on it to track my new project. Just made my first commit. I have a desktop (a Mac running on Snow Leopard) on the LAN with git already installed from 2014 and has an existing git repo in the home dir holding other existing projects (unrelated to the new one on the MacBook).

How do I share my new project onto the desktop git repo? Do I simply do a push to the existing repo on the desktop? I've been trying Remote > Push over ssh and would get:

Transport Error: Cannot get remote repository refs.
ssh://niemand@desktop:22/Users/niemand/git-repo/: cannot execute: git-upload-pack '/Users/niemand/git-repo/'

Then I tried Create Remote in Git Repositories view and got a Problem Occurred dialog at Create or Edit Refspec:

ssh://niemand@desktop:22/Users/niemand/git-repo/: cannot execute: git-upload-pack '/Users/niemand/git-repo/'
niemand
  • 43
  • 6
  • If you want to push to another Git repository in the filesystem of your local computer, the URL has to start with `file://`, not with `ssh://`. Or what do you exactly mean by _"desktop git repo"_? – howlger Jan 29 '22 at 08:35
  • By "desktop git repo", I am referring to the git repo that was set up in 2014 on the desktop machine (a Mac). That repo does not contain the new project that is on my MacBook, which has a git repo that I set up on the day I posted this question and made the first commit of the new project. On that same day, I encountered the problem that I was not able to share the new project onto the git repo that is on the desktop, which is on the same LAN as my MacBook. I hope this is clear enough. Thanks. I'll see if I can give your suggestion to use `file://` a try. – niemand Jan 30 '22 at 07:33
  • When not using the local protocol (`file://...`), make sure the Git server is set up correctly: https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols – howlger Jan 30 '22 at 08:38
  • @howlger Using file protocol to **Team > Remote > Push** does not allow me to specify a host name. The repository I want to share my project on is located on a different host in the same LAN. – niemand Feb 01 '22 at 00:00

1 Answers1

0

Double check your .bashrc and .profile in the account of the remote desktop machine.

As explained here, git-upload-pack might not set for the "non-login" shell. It depends on the remote OS (Windows, Linux, Mac?)

As a workaround, for testing, add the path of the remote git-upload-pack in your local command line, outside of EGit:

 git ls-remote --upload-pack /usr/local/bin/git-upload-pack sh://niemand@desktop:22/Users/niemand/git-repo/

(assuming you know where git-upload-pack is on the remote machine)

See also "'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository" (initially about HTTPS URL, but the answer is about SSH).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • `git-upload-pack` is located under `/usr/local/git/bin` on the desktop (Mac). Trying your command line suggestion: `$ git ls-remote --upload-pack /usr/local/git/bin/git-upload-pack sh://niemand@desktop:22/Users/niemand/git-repo/` I got: `git: 'remote-sh' is not a git command. See 'git --help'. The most similar command is remote-fd` I don't think git-remote-fd is relevant here (Reflect smart transport stream back to caller). – niemand Jan 31 '22 at 00:24
  • @niemand Strange. I never saw `remote-sh` before. Was it remote-sh or remote-https? (as in https://stackoverflow.com/q/51366101/6309) – VonC Jan 31 '22 at 07:48
  • Definitely `remote-sh`. ``` $ git ls-remote --upload-pack /usr/local/git/bin/git-upload-pack sh://niemand@desktop:22/Users/niemand/git-repo/ git: 'remote-sh' is not a git command. See 'git --help'. The most similar command is remote-fd ``` – niemand Jan 31 '22 at 08:52
  • Sorry, I am unable to format code output in a comment. Every time I try to do a line-break in code by pressing return, the page just submits the form right then and there. I even tried using Markdown language above, and it just looks ugly. Apparently Markdown language doesn't work either. – niemand Jan 31 '22 at 08:55
  • @niemand OK. What version of Git are you using on the remote Mac side? – VonC Jan 31 '22 at 10:13
  • 1.7.6 on Mac side. 2.35.0 on MacBook (local) side. Could that be an issue? – niemand Jan 31 '22 at 14:59
  • @niemand 1.7.6??? Wait: `git log -1 --format=%ai v1.7.6`, meaning `2011-06-26 12:41:16 -0700`. 2011? I wasn't even born yet! Is it possible to upgrade it to 2.35.1? – VonC Jan 31 '22 at 15:04
  • @niemand Let's see: https://stackoverflow.com/a/42582877/6309: `git log --diff-filter=A --summary| grep create | grep remote-sh`. I still don't see any `remote-sh` file... That's odd. – VonC Jan 31 '22 at 15:08
  • Well, the error does say that "`'remote-sh' is not a git command`". So I'm not surprised that you don't see any `remote-sh` file. The Mac desktop is running on Snow Leopard Server OS. (I don't want to change that.) – niemand Jan 31 '22 at 16:06
  • @niemand OK. I don't have enough experience with Mac in general to be of much help here. – VonC Jan 31 '22 at 19:45