-1

I am trying to pull some code into a server that I haven't touched in a while

However, when I tried pulling, I got forbidden. So I'm curious if the server project has the wrong git address. But when I try just looking at the Git address via git remote show origin, I get "Forbidden"

cody@app-server:~/app$ git remote show origin
Enter passphrase for key '/home/cody/.ssh/id_rsa':
Forbidden
fatal: Could not read from remote repository.

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

How can I get around this and continue pulling from my git repo as I was doing before?

CodyBugstein
  • 21,984
  • 61
  • 207
  • 363

1 Answers1

-1

To get the remote address:

Try

git remote show -n origin

This gives the remote info without pinging them.

You can also do

git remote -v

For quick look at the urls.

Adding your SSH public key to the server:

Apologies if this is obvious, but if you are able to verify that the git url is correct, the next thing I would check is the SSH key. Since it sounds like you already have an SSH key set up on the client side, a failed authentication may mean you need to add your ssh public key to the git server. This is different depending on your git server, but:

Since you seem to have an ssh key already, you will probably want to use the existing one for simplicity. Otherwise you'll need to configure ssh to use the right key for the right url.

Fixing access to your SSH private key:

Though it sounds more like a server access problem to me, I suppose it's possible that Forbidden could mean your id_rsa private key file has the wrong permissions. According to this answer, the right permissions for a private key file are 600, ie chmod 600 /home/cody/.ssh/id_rsa.

Or, though I think usually it would prompt you more than once when given an incorrect password, I guess it could mean that you have the incorrect password for your private key, in which case you can just create a new one with the instructions on one of the links above.

xdhmoore
  • 8,935
  • 11
  • 47
  • 90