0

I'm new to git but I've had things flowing fairly well until I tried pushing to my private server directly from my local machine using SSH. My local config, using an absolute path is the following:

[remote "origin"]

url = ssh://j@***.com:52836/home/j/www/wc.git
fetch = +refs/heads/*:refs/remotes/origin/*

My server's config is set as bare. When I push, after passwording in, I get the following error: stdin: is not a tty fatal: '/home/j/www/wc.git' does not appear to be a git repository fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I've cloned both my local repo and my private server from my bitbucket account. I want to be able to push from my local machine to both (using the pushurl) - but I simply cannot find my private server's repo. However, I can update my private server and bit bucket AND I can update my local machine and bit bucket. I simply cannot connect my local machine and private server (which is my production server). My private server repo is located at /Users/mark/sites/wc/. The .git folder is inside the wc folder.

I've tried Git "does not appear to be a git repository" and How to check the validity of a remote git repository URL? with no luck.

Community
  • 1
  • 1
thebarless
  • 470
  • 1
  • 12
  • 34
  • It get it that your private server is not in your local machine, right? – ffflabs Aug 19 '14 at 01:32
  • Right - my private server is in the internets. – thebarless Aug 19 '14 at 01:34
  • You say that your "server's config is set as bare" and that it's path is "/home/j/www/wc.git" but you then later say that the private repo path is "/home/j/www/wc" and it has a ".git" folder in it. So what, exactly, is the path on the remote (private) machine and is the repo on that machine actually bare? – Etan Reisner Aug 19 '14 at 01:37
  • Do you have j@*** on your ~/.ssh/config ? Anyway, try to set the url to ```ssh://j@***.com:52836:/home/j/www/wc.git``` (mind the ```:``` after the port number). – ffflabs Aug 19 '14 at 01:39
  • What is the **exact** command you are using? – Code-Apprentice Aug 19 '14 at 01:43
  • @EtanReisner, my apologies. Local repo is /Users/mark/sites/wc/ – thebarless Aug 19 '14 at 01:44
  • @amenadiel, with the second colon, it cannot resolve the host. – thebarless Aug 19 '14 at 01:50
  • @Code-Apprentice, "git push" – thebarless Aug 19 '14 at 01:52
  • I see. Sorry about that, I thought it might have worked since that's scp syntax. I don't have access to a terminal to try that right now. – ffflabs Aug 19 '14 at 01:52
  • As a side note, the error I published in the title is for pushurl. Both with a pushurl line to bitbucket or without it, it errors the same. So in the code config file posted in my question I removed it to limit complexity. – thebarless Aug 19 '14 at 01:56
  • Your remote should be -- git@bitbucket.org:*your-bitbucket-login*/*your-repository-name* -- hope that helps. – hd1 Aug 19 '14 at 01:57
  • @hd1, I'm trying to get it to my production server - my link to bitbucket is working fine from my local machine to bitbucket & from my server to bitbucket. My problem is my local machine to my production server. – thebarless Aug 19 '14 at 01:59
  • Wait. Which repo is `/Users` and which is `/home`? Because with your edit the config looks entirely backwards. The path on the `url` line should be the *remote* path. – Etan Reisner Aug 19 '14 at 02:00
  • @EtanReisner, on my local config, the local repo is: Helios:.git mark$ pwd /Users/mark/sites/wc/.git On my production server: jwindham@windhamsheriff.com [~/www/wcso/.git]# pwd /home/j/www/wc/.git – thebarless Aug 19 '14 at 02:04
  • 1
    `wc/.git` doesn't look like a bare repo... or if it is a bare repo it is an oddly named one. In either case you need to point your config at the toplevel of a bare repository. And besides that `wc.git` and `wc/.git` are not the same path. – Etan Reisner Aug 19 '14 at 02:06
  • @EtanReisner, I destroyed the directory and repo, then cloned with the --bare flag and it worked like a charm. If you want to post an answer saying "you can't change the config file to make it a bare repo, idiot" I'll accept. Thanks for the help. – thebarless Aug 19 '14 at 02:13
  • Actually, you can clone non-bare and convert to a bare repo but you actually need to do the conversion and change the config to match. But it looks like you didn't do the conversion and only changed the config which got git all confused... and/or you just always had path typo problems. – Etan Reisner Aug 19 '14 at 02:30

1 Answers1

1

Some sort of path or bare repo confusion appeared to be at work here. Resolution was to recreate the private repo ensuring that it was a bare repo and to point the remote url config entry at the correct path.

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148