0

Originally i established a repository on sda3, from the Linux OS on sda7, using user "git". I (user "sbh") work on the cloned files from sda7 in a local working copy and can successfully commit, push, etc. This was set up from sda7 by

git clone git@sbh-MBP:/mnt/sda3/Repo

On sda8, another Linux OS with the same UID and GID, I ("sbh") want to clone to a working folder on sda8 but

git clone git@sbh-MBP:/media/sda3/Repo

doesn't work. Both OSs have the same hostname too. Both OSs have a user named "git" too. UID/GID of sda8 is 1000/1002; and those for sda7 are the same, both for"git". Both OSs have same UID/GID for "sbh":. 501/20

All the questions I found pertain to actual remote, server side repos. Though I think this will boil down to a simple git answer.

My error when i try to clone is;

ssh: connect to host sbh-MBP port 22: Connection refused fatal: Could not read from remote repository.

I am new to git...

Thank you

PS: It took more than one reboot apparently and now my error is new, as reflected above.

Is something like git-init share=true necessary?

Another Update

I edited my fstab in sda7 so they, the one in sda8, refer to the same space in the SSD. I also ran, as user "sbh" in sda7 in working copy,

git remote set-url origin git@sbh-MBP:/media/sda3/Repo
6
  • What's the hostname set on each OS? Run hostname. Or, just use localhost.
    – Bob
    Oct 31, 2016 at 4:28
  • sbh-MBP for both...
    – nate
    Oct 31, 2016 at 4:36
  • It's not a problem with git. Somehow SSH (which is invoked by git) isn't able to resolve the host name, i.e. translate it to an IP address. Maybe you could update your question and the tags.
    – Mario
    Oct 31, 2016 at 7:03
  • Well i wouldn't know what to update the question to... On a side note, I just realized I automount sda3, in sda7, to a different path than what i use in sda8. So the repos .git/config has a url that is different than what it would be from sda8. Can a repo have 2 urls?
    – nate
    Oct 31, 2016 at 7:35
  • So, in essence, sbh-MBP == localhost. Why not use that?
    – Daniel B
    Oct 31, 2016 at 9:21

2 Answers 2

1

Now with the updated error message, the issue is evident:

ssh: connect to host sbh-MBP port 22: Connection refused fatal: Could not read from remote repository.

(Emphasis mine.)

That means you just don't have a SSH server running on that host. It could also be the firewall denying access, but that's less likely.

1
  • Thanks Daniel, I had the openssh and openssh-server and openssh-sftp-server installed, no firewall. But forcing a reinstall fixed it. :)
    – nate
    Nov 2, 2016 at 20:36
0

This is not a Git problem – this happens entirely within SSH.

Also, as the error message says, it has nothing to do with paths but with hostnames – the OS is unable to translate sbh-MBP to an IP address.

If this is the system's own hostname, it's usually resolved via /etc/hosts or using the nss-myhostname module. Make sure at least one of those is set up.

2
  • Yeah, I successfully use git all the time from sda7 so i didn't think git was damaged. But i changed both/etc/hostname and the 127.0.0.1 line in /etc/hosts... So maybe i should just force reinstall ssh....
    – nate
    Oct 31, 2016 at 21:58
  • Maybe i can get some hints from ssh -vvv git@sbh-MBP...
    – nate
    Nov 1, 2016 at 7:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .