0
igor@IgorReinCloud ~/dbhandler $ ssh igorkorot@192.168.1.3:/dbhandler/dbhandler < git pull
bash: git: No such file or directory
igor@IgorReinCloud ~/dbhandler $ git pull
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/oneeyeman1/dbhandler
   667ca95..4a93607  master     -> origin/master
Updating 667ca95..4a93607
Fast-forward
 libdbwindow/databasecanvas.cpp | 1 +
 1 file changed, 1 insertion(+)

Does this mean I should create some kind of script with just git pull inside to be properly executed? Or I am doing something wrong?

[EDIT]

What I'm trying to achieve is following:

I'm on my Linux box trying to connect to one of my OSX laptops (192.168.1.3). This Mac laptop is running OSX 10.8. Up until recently everything was working fine, but then GitHub switched from using SSL 1.0 to SSL 1.2 or something like this. And of course trying to perform remote operations from OSX is now failing.

However if I try to perform this on Linux everything works as expected since Linux version of Git/OpenSSL is newer and therefore running git pull/fetch/push/etc will succeed.

And so my ultimate goal here is to do git pull to execute the git from the local machine (Linux) to update the repository that is located on remote machine (OSX).

I hope it is now clear what I'd like to achieve.

[/EDIT]

  • What's your goal? To have the stdout from running git pull sent through ssh? Looks like you and bash are trying to read a file called git pull as input for ssh – Xen2050 May 11 '18 at 12:50
  • @Xen2050, please see the edit. Hopefully now it is more clear. – Igor May 11 '18 at 14:26
6

< is an operator to redirect a file as an input. git pull is a command, not a file. You can do it like this:

echo "git pull" | ssh igorkorot@192.168.1.3:/dbhandler/dbhandler

Or the correct way:

ssh igorkorot@192.168.1.3:/dbhandler/dbhandler git pull

Take a look at possible invocations in man ssh:

ssh (...) [user@]hostname [command]

You have an optional command there.

I wonder if your command doesn't need an additional fix:

ssh igorkorot@192.168.1.3 bash -c "cd /dbhandler/dbhandler && git pull"

^ I don't think your path should be there when executing commands. With bash -c "some-commands" you can circumvent this.

Edit:

After clarification it seems that a good solution is mounting Mac's project folder on Linux machine and use git there, while doing everything else on Mac. You can do it by using SSHFS: https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh

My preferred solution would be upgrading your Mac's git so it supports SSL 1.2. If there's no update for Mac yet, you can try compiling it yourself and installing the compiled version.

  • my ultimate goal is to connect through ssh to second machine changing the home directory and in that directory execute the command from the local machine. Local is Linux and remote is OSX 10.8. As 10.8 uses old version of OpenSSL/Git I can't simply execute it on Mac. I believe all solutions you posted will execute git version from the OSX (remote) and not from Linux (local). Am I right? – Igor May 11 '18 at 13:26
  • @Igor Yes. I'm not sure now what is your basic need. Do you want to delegate git commands to Linux, but otherwise do everything with the repo on your Mac? If so, you can mount your Mac folder on the Linux machine. This way you have access to the repo on both computers. – Ctrl-C May 11 '18 at 13:56
  • please check the edit. I hope it is clear now. Also you says I can mount Mac folder on Linux? How? It might be easier than trying to execute a git locally against a remote repository, but I don't even remember if I have a support in kernel for OSX FS... – Igor May 11 '18 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.