0

I'm aware that this is probably a basic question, but I am new to both Git and command line. A colleague set up my mac to access a repository at work, but now I need to change it so that commits are under my name. His login details are also preventing me from accessing my own repository, giving me the 403 below:

remote: Permission to name/repo.git denied to aColleague. fatal: unable to access 'https://github.com/name/repo.git/': The requested URL returned error: 403

Any suggestions on how I can change this through the terminal please?

Stamp
  • 933
  • 1
  • 9
  • 18

2 Answers2

0

It is a bit hard to say how he set what up, but generally you will have the URL and credentials encoded in .git/config. You could change it there, but a new checkout is easier. I suspect he also set up a SSH key to auto-login to the server. In that case you need to create a new SSH key (~yourmacuser/.ssh/id), and add the public part on the server (~youruser/.ssh/authorized_keys).

eckes
  • 9,711
  • 1
  • 55
  • 69
  • I couldn't find a way of accessing the config file via the command line, but could by changing the github.com settings in Applications > Utilties > Keychain Access. I also created a new SSH key as per https://help.github.com/articles/generating-ssh-keys/, but as I did this first I'm not sure if it was necessary? Thanks very much for your help. – Stamp Jan 18 '15 at 21:13
0

This problem happened a while ago to me too, namely the following happened:

Error: The requested URL returned error: 403 while accessing
https://github.com/Joey-project/repo.git/info/refs
fatal: HTTP request failed

It seems to happen because of bad login credentials from your local machine to the server.

If I remember correctly, one has to

(1) Make sure you have a stable git version

(2) Ensure the remote is correct

(3) Provide access token if 2FA is enabled

(4) Checking your permissions(username/password)

(5) Use ssh instead of https

Perhaps take a look at this link for further information: Pushing to Git returning Error Code 403 fatal: HTTP request failed.

Joey

Community
  • 1
  • 1
Joey Dorrani
  • 371
  • 1
  • 1