Search code examples
gitgithubgit-bashgit-remote

Pushing to another user's remote repository without the use of pull requests


I'm trying to make a github repository on which a group of 4 users can work on at the same time, without having to make a pull request for every push or making a fork every time a change is made.

However, when anyone who isn't the creator (me) adds the remote URL and tries to push to the master branch it denies access to the user, even though the user is added on the github page as a contributor.

To figure this out I told one of the users to fork the repo and add me as a contributor so that I could try pushing new changes, but I'm experiencing the same issue.

I did the following in Git Bash:

$ git clone https://github.com/Diseasedfire/AlaBonteKoe.git
Cloning into 'AlaBonteKoe'...
remote: Counting objects: 3027, done.
remote: Compressing objects: 100% (66/66), done.
remote: Total 3027 (delta 27), reused 0 (delta 0), pack-reused 2955
Receiving objects: 100% (3027/3027), 37.23 MiB | 588.00 KiB/s, done.
Resolving deltas: 100% (494/494), done.
Checking connectivity... done.

$ vim README.MD

(I make edits to the readme)

$ git commit -a -m "test remote commit"
[master 318b667] test remote commit
 1 file changed, 1 insertion(+)

$ git remote add origin https://github.com/nebbii/AlaBonteKoe.git
fatal: remote origin already exists.

$ git remote -v
origin  https://github.com/Diseasedfire/AlaBonteKoe.git (fetch)
origin  https://github.com/Diseasedfire/AlaBonteKoe.git (push)

$ git push origin master
remote: Permission to Diseasedfire/AlaBonteKoe.git denied to nebbii.
fatal: unable to access 'https://github.com/Diseasedfire/AlaBonteKoe.git/':
The requested URL returned error: 403

Is it possible to push changes to the repo as a listed contributor without having to create pull requests?


Solution

  • It absolutely is possible!

    I would recommend using the SSH protocol to clone the repository. That way your are using you ssh keys to authenticate instead of http basic authentication.

    $ git clone [email protected]:Diseasedfire/AlaBonteKoe.git
    

    See the documentation on Github as well.