-1

I am completley new to git. I am working on SL6 and created a file in the local repository. I have already created a remote repository on GitHub. I added a new file, and committed it, but I get the following error when I try to push to the repository

error: The requested URL returned error: 403 Forbidden while accessing

any help would be great, especially if it has been idiot proofed :)

2 Answers2

0

To definitely be able to login using https protocol, you should first set your authentication credential to the git Remote URI:

git remote set-url origin https://yourusername@github.com/user/repo.git Then you'll be asked for a password when trying to git push.

In fact, this is on the http authentication format. You could set a password too:

https://youruser:password@github.com/user/repo.git You should be aware that if you do this, your github password will be stored in plaintext in your .git directory, which is obviously undesirable.

so in such a way you won't get a 403 error

Karim Baidar
  • 677
  • 3
  • 10
0

You also can, if you don't want to deal with your GitHub user account password (by encrypting a _netrc file), change the url of your remote to an ssh one.
See "Generating SSH Keys".

Then type (more in "Changing a remote's URL"):

cd /path/to/your/repo
git remote set-url origin git@github.com:YourUserName/YourRepo
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250