0

I am having this problem with github. I'm trying to push new project to github but i'm getting this error.

enter image description here

[Edit: this is a "permission denied", using https to push to GitHub, but without anything asking for a user name and password. OS is Windows 10.]

torek
  • 448,244
  • 59
  • 642
  • 775
m1alesis
  • 670
  • 6
  • 16
  • This is specific to GitHub; it means that when you connect to GitHub, you hand them authentication data that, in their own database, tells them that you are someone named `cmash`. Then, they look at `rthapa/smartcardreader.git` and find that the user `cmash` is not permitted to do whatever it is you are doing (push something, in this case). You will need to petition GitHub and/or whoever controls access to that repository to grant access to user `cmash`, or authenticate yourself as some other user who *does* have permission. – torek Nov 21 '16 at 23:15
  • Usually when I push, I get to enter username and password. This time I did not get prompted to enter username or password. Also i checked git config --global user.name and I get "rthapa" not cmash. And this is my repository. – m1alesis Nov 21 '16 at 23:22
  • GitHub *completely ignores* your `user.name`. It uses only the authentication you send them. When you push with `https` and enter a user name and password, that is the authentication you send. If you are not being prompted to enter a user name and password, you might want to check any cached or stored authentication credentials. This is OS-dependent, so you may need to mention which Git and OS you are using. – torek Nov 21 '16 at 23:33
  • ahh I see. I'm using git bash and windows 10. Still struggling to find a way to clear stored authentication. – m1alesis Nov 21 '16 at 23:36
  • Generic information on Windows credential storage: https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage – torek Nov 21 '16 at 23:39
  • Hi torek, yes you were right. I just followed this post http://stackoverflow.com/questions/18157583/git-credential-helper-cache-never-forgets-the-password#answer-18542920 and fixed the issue by unseting credential helper. You can add this as answer and i'll accept it. – m1alesis Nov 21 '16 at 23:51

2 Answers2

0

I guess your are user cmash and you are trying to push some changes you made someone else's (user rthapa) project (smartcardreader).

In order to do so, you need first to fork in github the original project in github, which will now have the url https://github.com/cmash/smartcardreader

You then push/pull to your own (forked) repo, and if you want to push back to the original project, you need to create a pull request to the original owner.

You can read more about this at https://help.github.com/articles/creating-a-pull-request-from-a-fork/

jsalatas
  • 255
  • 2
  • 9
0

Note that GitHub completely ignores your configured user.name. It uses only the authentication you send them.

When you push with SSH (ssh://git@github.com/path/to/repo.git), the authentication you send is your SSH key. The details of how this are stored are somewhat OS-dependent.

When you push with HTTPS (https://github.com/path/to/repo.git), you will generally have to enter a user name and password. These make up the authentication you send. If you are not being prompted to enter a user name and password, you might want to check any cached or stored authentication credentials. The details are, as before, OS-dependent.

Git does have a few built-in "credential helpers" for HTTPS. The default one simply asks for user name and password every time. The "cache" helper stores them in memory and times them out, and the "store" helper which is not secure stores them as plain-text files, meaning anyone with access to your files can find your password. See https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage for details on these.

You can install additional helpers, and some come with some OSes, that do store authentications more permanently, but also store them reasonably securely, the same way SSH does.

Existing StackOverflow post git credential.helper=cache never forgets the password? has additional information on setting and clearing credential helpers (although the specific questions about why the cache timeout was not working, way back in Git 1.7.10.4, are not answered there).

Community
  • 1
  • 1
torek
  • 448,244
  • 59
  • 642
  • 775