Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing to Git returning Error Code 403 fatal

I want to push README.md to Github.
Using Ubuntu 14.04LTS
So, I commit in the following steps.

echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/user/repo.git
git push -u origin master

But, below error occurred.

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

fatal: HTTP request failed

I know solve this error this way

git remote set-url origin https://[email protected]/user/repo.git

In this way , I must enter password.

$ git push origin master
Password: 

But I hate to enter password.

I have checked this, but I don't solved.
Pushing to Git returning Error Code 403 fatal: HTTP request failed

Please tell me how to push without password.

like image 461
technuma Avatar asked Jan 17 '15 04:01

technuma


People also ask

How do I fix the requested URL returned error 403 in git repository?

The first is relatively simple to resolve and simply involves checking to ensure your GitHub password is correct. If the error persists, it is likely that you have to use a different HTTPS address in your Git client. For this error, you will not even be prompted to enter a password, making it simpler to diagnose.

How do I resolve a fatal error in git?

For the second situation, you need to initialize the Git repository in your project folder. To do so, you need to navigate to the correct folder and then run the command git init , which will create a new empty Git repository or reinitialize an existing one.


1 Answers

This may solve your problem:

git remote set-url origin https://username:[email protected]/user/repo.git
like image 126
dilei Avatar answered Sep 29 '22 21:09

dilei