3

In over my head here. My repo was public, but is now private. I'm trying to pull from origin on my CentOS box via command line.

When I try to do git pull origin I get:

 error: The requested URL returned error: 403 Forbidden while accessing <remote path to git>

From memory I never set up my username/password with Git on this box so I tried following the instructions here: https://help.github.com/articles/set-up-git#platform-linux

But this has done nothing / I was never asked for my password. To clarify, I entered the same email that is linked to my github account.

Googling "log in to git from command line" yields nothing helpful. How on earth do I log in to this thing?

JVG
  • 20,198
  • 47
  • 132
  • 210
  • How did you clone the repository? Are you maybe using ssh authentication? If that is the case, you should add the public SSH key of your CentOS machine to GitHub. – Ben-G Dec 10 '13 at 04:15
  • phone the guys at github :) – jondinham Dec 10 '13 at 04:15
  • @Ben-G I cloned it when it was a public repo using the HTTPS clone link on my repo's page. – JVG Dec 10 '13 at 04:35
  • @Ben-G When I try to re-clone it in a different dirrectory I get the same error, `403 Forbidden`. Appears that I'm just not logged in as the right account but I have no idea how to change this. – JVG Dec 10 '13 at 04:41
  • @Ben-G I managed to re-clone it into a different folder using `git clone http://user@repodir.git`, but it's not remembering the password for this and I still can't pull from the original folder. – JVG Dec 10 '13 at 04:50
  • @Jascination can you check this: https://help.github.com/articles/setting-your-username-in-git to see if your global username is set as expected? For the original folder it would probably be easiest to remove and add the remote repository again. – Ben-G Dec 10 '13 at 04:53

1 Answers1

2

With https, you can:

  • put your username in your remote url, even in your original repo:

    git remote set-url origin https://YourName@github.com/YourName/yourRepo.git
    
  • store your password in a ~/.netrc file, or in a credential helper cache.
    See "_netrc/.netrc alternative to cURL".

I prefer the gpg-encryption credential helper to the memory cache credential helper mentioned by GitHub, because you need to enter only one password, for all your credentials (not just GitHub, but also possible remote repo to other Git hosting providers, like BitBucket).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250