Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git access to private repository using HTTPS

Tags:

git

git-clone

Trying to clone a private repository I have access to using HTTPS protocol, as that is only allowed outgoing traffic.

git does not ask for passwords, just failed.

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/blah/blahblah.git/info/refs 

What am I missing ?

like image 830
Ask and Learn Avatar asked Jun 03 '14 07:06

Ask and Learn


People also ask

Should you use https or SSH for git?

While SSH is usually considered more secure, for basic usage of Github, HTTPS authentication with a password is acceptable enough. In fact, Github themselves defaults to and recommends most people use HTTPS.


1 Answers

Did you try inserting the username (and optionally password) in the clone URL?

 git clone https://[email protected]/blah/blahblah.git 

or if you accept the consequences of storing your password in plain view:

 git clone https://username:[email protected]/blah/blahblah.git 

See this thread with a lot of good info:

How to provide username and password when run "git clone [email protected]"?

EDIT: My original answer was just a quick fix, without understanding the full history of the asker, and it also works unattended, but for best security practices its better to let Git store your password. See @phpguru's answer: https://stackoverflow.com/a/29018371/257090 as well.

like image 52
codenheim Avatar answered Oct 11 '22 12:10

codenheim