Remote permission denied in github while trying to push to origin - github

I have started to contribute to a public repository on GitHub, but after I have created a pull request it says remote: Permission when I am trying to push another code to my origin.
remote: Permission to una/CSSgram.git denied to Pradhvan. fatal:
unable to access 'https://github.com/una/CSSgram.git/': The requested
URL returned error: 403

Anyone else having the same problem. The issue would be you had cloned the repo from Github of the owner(here Una's repo) and you are pushing that change directly to the repo. This is the not right way as you don't have permission to push changes to that repo.
The right step would be:
Fork the original repo so you get a copy of it. Url of your forked repo would be something like https://github.com/<your Github username>/<repo_name>
Clone the repo that you just forked.
Create a branch (git checkout -b "MyPatch1") and now make the changes to the code.
Push the changes to your fork (git push origin MyPatch1)
Open Github and go to the owner's repo and you would see a button appear Click the Compare & pull request button.
Congratulation! You have successfully created a pull request.
PS: The funny thing is this question just showed up after 4 years. xp

Related

Create a pull request from a repository that is not a fork on github

forking iss not allowed (for this repository on github). So what I did was I cloned the repository to my local folder, Then made my changes and did a commit. then pushed it into my own repository on github.
Problem, my repository is not denoted as a fork in github. So there is no way to create a pull request to the original repository.
How do I set my upstream in github?
I tried to set upstream using git remote add, and create a pull request using git request-pull. But while the commands were successful, nothing showed up in github... my repository still does not show as a fork
when I try to create a pull request from the website, pushing "new pull request" button, I only see the same branch, I do not see my own fork even when choosing "across forks"
You cannot create a pull request from a repository that is not a fork. On GitHub, all the forks, plus the main repository, form a repository network, which shares objects. This is a requirement in order to create a pull request.
If you have push access to the original repository, then you can push your branch there and create a pull request from there. If you don't and the repository owner has prohibited forking, then you'll need to talk with them about how to get your change proposed.

how to solve the requested URL returned error: 403 on bitbucket? and setup to push both on github and bitbucket?

I forked a repo from bitbucket for my internship test. I worked on it. then I did:
git init
hub create
now when i have to push to bit bucket and I want
to push also on github but i get this error:
unable to access 'https://bitbucket.org/aaa/bbb.git/': The requested
URL returned error: 403
I never used bitbucket and always github. I wanna be able to use both. The repo is open to everyone and I need to make a pull request to let them evaluate my code. I dont understand how need to install ssh key/bitbucket credentials on my local machine to access it. It seems confusing.
DOES anyone have any clue how to set up both bitbucket and github and fixing this error? I have to hand in by the end of the week and I am lost.
The repo is open to everyone
For pulling/cloning, yes, it is opened to everyone, not for pushing.
Only the owner/collaborators of the bitbucket.org/aaa/bbb.git can push to it, so if you want to make a pull request from a BitBucker repository, you need to push to to your fork, not the original repository.
You can push to multiple repositories:
git remote set-url --add --push origin https://github.com/<you>/<yourRepo>
git remote set-url --add --push origin https://bitbucket.org/<you>/<yourFork>
# Or, if you are using a registered SSH key to your BitBucket account
git remote set-url --add --push origin git#bitbucket.org:<you>/<yourFork>

Error While commiting to Github

remote: Repository not found.
fatal: repository 'https://github.com/vivekghanchi/portfolio.git/' not found
You need first to create your repository in GitHub (it's done directly in your Web browser). Then you can do a git push to upload your local commits to the new repository.
Also, after creating your GitHub repository, make sure the url you are pushing to matches that of GitHub, I notice an extra / at the end of your url, which should not be there.
To see the url you are pushing to, issue:
git remote -v
the repository is deleted but I was committing to a new repository after than also it is showing this
Committing is a local operation.
Make sure your remote url matches the one of your new repo.
Update it with:
cd /path/to/my/local/repo
git remote set-url https://github.com/vivekghanchi/aNewRepo
Then try to push again:
git push
Pushing is not "committing to GitHub", but rather "publishing your local commits to your upstream GitHub repository".
You need first to create your repository in GitHub (it's done directly in your Web browser). Then you can do a git push to upload your local commits to the new repository.
Committing is a local operation.
or your can add already existing repo
git remote add origin remote repository URL

How do I make a pull request using EGit?

I have a local master branch and I want to create a pull request with a repo owned by somebody else. When I attempt to "push branch", I get the following text: "can't connect to any URL: https://github.com/jleclanche/fireplace: git-receive-pack not permitted"
I'm guessing that what I'm doing here is actually trying to merge, rather than making a request. How would I do this?
These are the steps necessary to fork a repository, make changes and finally open a pull request to have the changes merged back into the originating repository.
On GitHub, navigate to the repository's page and click the Fork button in the top-right corner of the page
Copy the URL of the forked repository to create a local clone in EGit
I recommend creating a new branch in the form your-name/issue-name. Working on a separate branch gives a better oversight and helps when working on multiple pull requests in parallel.
Make one or more commits that should end up in a pull request.
Push these changes to the forked repository.
On GitHub, navigate to the fork's page. You should see a message there indicating that a new branch was created and a button to create a pull request. Click this button. On the next page, you can provide more information and finally confirm the creation of the pull request.
In order to consume changes made to the originating repository, you would want to add it as a remote to your local clone.
You may even want to rename the remotes, so that the forked repository (the one you are pushing to) is named fork and for the originating repository use the default name origin.
For example:
[remote "fork"]
url = git#github.com:your-name/forked-repo.git
fetch = +refs/heads/*:refs/remotes/fork/*
[remote "origin"]
url = git#github.com:user/originating-repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
In this answer, I assume that you have commit rights on the project in question, but still want to create a pull request. In this case, it's not necessary to fork the repository.
Create a local branch in Eclipse (Team -> Switch to -> New branch..., use the default values) and work on it. Eventually, push the branch to the GitHub repository.
Go to the repository on github.com.
GitHub will usually recognize that you have pushed a branch and offers the
option to create a pull request directly. Alternatively, you should be able to create a pull request from the "pull requests" tab.
If From Eclipse you commit the changes but due to conflict you cant get the Pull Request so do following steps to get pull req from git bash command
git status
git checkout develop-robot
git log [check your commit present or not]
git pull
git checkout
git rebase develop-robot
git push -u -f origin

Unable to git push julialang

I'm trying to get the latest julia master commit.
I instaled it via git clone, however, when I do
$ git push
It returns an exception:
fatal: remote error: You can't push to git://github.com/JuliaLang/julia.git
Use https://github.com/JuliaLang/julia.git
If I use the option given, git requires me a password.
It sounds like you probably don't actually want to push to the JuliaLang repository, but rather pull from it.
You git pull to fetch upstream changes and integrate them into your local repository. So, for example, to update and rebuild Julia, you would git pull && make clean && make from within julia's directory while on the master branch.
You would only git push if you were a contributor submitting changes. But even among contributors who have commit access, very few actually push directly to the master branch. Most create branches, submit those, and then open a pull request for a review. And for that workflow, you don't even need to be a contributor. You can "fork" the project on Github, and then push to your forked repository online. From there, you can open a pull request for review.
git:// doesn't allow for authentication.
ssh or https does.
In the case of https, it is asking for your GitHub username and password.
See more at "Git - the Protocols".
GitHub needs to know who you are, because only the owner (or a collaborator) has the right to push (while everybody can clone/pull from a public repo, which is why git:// works for cloning).
See "Permission levels for a user account repository".
Note: here github.com/JuliaLang is an organization, which means only the owner and members/teams can push to a repo declared in that organization.
Se more at "Permission levels for an organization repository".