JVG
JVG

Reputation: 21150

Git - How to log in and pull a private repo?

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?

Upvotes: 3

Views: 3244

Answers (1)

VonC
VonC

Reputation: 1323203

With https, you can:

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

    git remote set-url origin https://[email protected]/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).

Upvotes: 2

Related Questions