push origin HEAD error

1

I did git clone to a repository hosted on github:

$ git clone https://github.com/USUARIO/REPOSITORIO.git

Then I did a git fetch --all to move to the branch dev :

$ git fetch --all
$ git checkout dev

To make sure I was in dev :

$ git branch
*dev
master

Now, my problem is that I want to work on that repository with a specific user, for which I executed:

$ git config user.email [email protected]
$ git config user.name MI_USUARIO_ESPECIFICO

I checked the local configuration file of git which I returned correctly:

$ cat .git/config
[user]
    email = [email protected]
    name = MI_USUARIO_ESPECIFICO

I added a file to the project:

$ git add assets/js/dependencies/jquery.min.js

I did his respective commit which he did correctly:

$ git commit -m "Dependencia jQuery añadida"

I proceeded to make your push origin HEAD

$ git push origin HEAD

And he returned this error:

remote: Permission to USUARIO/REPO.git denied to MI_USUARIO_GLOBAL.
fatal: unable to access 'https://github.com/USUARIO/REPO.git/': The requested URL returned error: 403
  

Should I not ask for the credentials of the USER_ESPECIFICO?

     

Why is this error and how can I correct it?

NOTE

  

I am sure that the repository exists and the USER_ESPECIFICO already has permissions in it

    
asked by Jorius 12.11.2016 в 01:17
source

2 answers

0

Dude, if you are using a Linux distribution, you only need to execute the command:

$ git push origin HEAD

With user permissions, for example if you use ubuntu or any based on:

$ sudo git push origin HEAD

It has happened to me, and I think that is the problem, Greetings! :)

    
answered by 12.11.2016 в 02:05
0

The problem may be the protocol, try the following, edit .git/config and within the section [remote "origin"] look for the following:

url=https://github.com/USUARIO/REPO.git

And change http by ssh or git , like this:

url=ssh://github.com/USUARIO/REPO.git

or

url = [email protected]/USUARIO/REPO.git

If the problem is the protocol, that should solve the problem.

    
answered by 12.11.2016 в 02:24