2

I have two public repositories: origin and peterI:

C:\Users\[path]\app>git remote -v
origin  ssh://manuelM@example.net/~manuelM/public_html/public.git (fetch)
origin  ssh://manuelM@example.net/~manuelM/public_html/public.git (push)
peterI  ssh://manuelM@example.net/~peterI/public_html/public.git (fetch)
peterI  ssh://manuelM@example.net/~peterI/public_html/public.git (push)

When I try to fetch the latest code from the public repository peterI, I get this error:

C:\Users\[path]\app>git fetch 
manuelM@example.net's password: [My password] 
fatal: '~peterI/public_html/public.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.

The repository definitely exists: ssh://manuelM@example.net/~peterI/public_html/public.git. What access rights do I need to configure? Maybe something about permissions? Thanks.

UPDATE 1. I tried what Trevor Tracy suggested in his answer and no success:

C:\Users\[path]\app>git remote -v
origin  ssh://manuelM@example.net/~manuelM/public_html/public.git (fetch)
origin  ssh://manuelM@example.net/~manuelM/public_html/public.git (push)
peterI  ssh://manuelM@example.net/~peterI/public_html/public.git (fetch)
peterI  ssh://manuelM@example.net/~peterI/public_html/public.git (push)

C:\Users\[path]\app>git remote remove peterI

C:\Users\[path]\app>git remote -v
origin  ssh://manuelM@example.net/~manuelM/public_html/public.git (fetch)
origin  ssh://manuelM@example.net/~manuelM/public_html/public.git (push)

C:\Users\[path]\app>git remote add peterI ssh://manuelM@example.net/~peterI/public_html/public.git

C:\Users\[path]\app>git remote -v
origin  ssh://manuelM@example.net/~manuelM/public_html/public.git (fetch)
origin  ssh://manuelM@example.net/~manuelM/public_html/public.git (push)
peterI  ssh://manuelM@example.net/~peterI/public_html/public.git (fetch)
peterI  ssh://manuelM@example.net/~peterI/public_html/public.git (push)

C:\Users\[path]\app>git fetch peterI
manuelM@example.net's password: [My password]
fatal: '~peterI/public_html/public.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.


C:\Users\[path]\app>

UPDATE 2. I went to see the file .git\config and this is what I see at the end of that file:

[remote "peterI"]
url = ssh://manuelM@example.net/~peterI/public_html/public.git
fetch = +refs/heads/*:refs/remotes/peterI/*

The public repository ssh://manuelM@example.net/~peterI/public_html/public.git seems to be there. What could I be doing incorrectly? Maybe I need specific permissions for ssh://manuelM@example.net/~peterI/public_html/public.git?

UPDATE 3: I am starting to suspect that this is a problem about files and folder permissions in Linux.

Jaime Montoya
  • 6,915
  • 14
  • 67
  • 103
  • 1
    Please show `git remote show peterI`. What happens if you type the url into a browser? – Christoph Jun 01 '18 at 15:58
  • @Christoph `git remote show peterI` returns this: fatal: '~peterI/public_html/public.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. – Jaime Montoya Jun 01 '18 at 16:05
  • @Christoph Do you mean this URL into a browser?: `ssh://manuelM@example.net/~peterI/public_html/public.git`. It searches for that in www.google.com. – Jaime Montoya Jun 01 '18 at 16:10
  • Yes. Exactly what you supplied to git. – Christoph Jun 01 '18 at 16:19
  • @Christoph It just tries to search for `ssh://manuelM@example.net/~peterI/public_html/public.git` in www.google.com. – Jaime Montoya Jun 01 '18 at 16:29
  • I guess something with your address is wrong. Cann you access via https? You can try this in the browser of your choice ;-) – Christoph Jun 01 '18 at 16:50
  • @Christoph When I try `https://manuelM@example.net/~peterI/public_html/public.git`, it redirects me to `https://example.net/~peterI/public_html/public.git` and I see `HTTP ERROR 500` in the page, using the web browser Google Chrome. – Jaime Montoya Jun 01 '18 at 16:54
  • 1
    See https://en.m.wikipedia.org/wiki/List_of_HTTP_status_codes. I would rewrite the question. – Christoph Jun 01 '18 at 17:08
  • @Christoph No need to rewrite the question. I just fixed the problem. It was caused by user groups and permissions. I will write the answer in case this can help someone else in the future. – Jaime Montoya Jun 01 '18 at 17:45

2 Answers2

1

It was a permissions problem. I had to create a group and add users to it. Then change the group ownership of the Git folders to this group that I created, and the problem was fixed.

I had migrated from one server to another one, and for some reason the group was not the same for the Git folders during the migration process. Everything is working correctly now, the problem was about permissions.

Jaime Montoya
  • 6,915
  • 14
  • 67
  • 103
0

Try git fetch peterI

You could also remove the old remote:

$git remote remove peterI

And add the missing remote:

$git remote add peterI ssh://manuelM@example.net/~peterI/public_html/public.git

$git fetch peterI master
Trevor Tracy
  • 356
  • 1
  • 10