unable to push files to github - 403 - github

So I just started off with github, I created two accounts to practice with. One as myself and another as a different user to test pushing files. This is a public repository.
So I'm able to push files with my account.
However when I use my 2ndary account and clone my repo and then try to push as a different user I get error 403. I'm using https.
I just installed the lastest git from git-scm.

In GitHub if you go to the repository settings and under the Collaborators section you should be able to add that second user. Reading that section it says that it allows push access to the repository.

HTTP 403 is "permission denied"; this clearly indicates you're either not authenticating with the right credentials, or the second user doesn't have push rights to that repo (which is the case unless you explicitely give the second user push rights).

Related

Unable to push code to github as a collaborator

Whenever I'm trying to push my code to github as a collaborator I'm getting an error saying I don't have enough permission with error 403, although I'm added as a collaborator. I'm using linux.
I've created a personal access token for the account where I'm going to contribute (yes that's my account also) and used that token as password at the time of pushing and it worked but I know it's a workaround and not the actual method. How can I solve it?

How to clone a repository that needs SSO in GitHub Desktop?

I am trying to clone a repository. It needs SSO to view it. I use a Personal Access Token(with repo permission) for push, pull, etc.
Now I am trying to use GitHub Desktop, but it says authentication failed when I'm trying to clone the repository. Entering the correct credentials is throwing the same error.
How can I clone this repository and use it in GitHub Desktop?
PS: Other repositories(that don't need SSO) are cloning fine.
You need to go to Preferences -> accounts and sign in there. What helped in my case was to sign out and sign in again using the option to sign in with browser.
Also this documentation was helpful : https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/installing-and-authenticating-to-github-desktop/authenticating-to-github

Push to GitHub repo with another user

I have on my Mac two GitHub users, one is for work and another is personal. I set them up following this tutorial:
https://medium.com/#ibrahimlawal/developing-with-multiple-github-accounts-on-one-macbook-94ff6d4ab9ca
I created a repo with my personal account, and tried to do a push with the work account, and to my surprise, it let me do this. I thought it should stop me from doing it because the work user should not have access to the personal GitHub. How can I avoid it? I want to be able to push to a personal repo with only my personal account, and to my work repos only with my work account.
The article is about managing two different SSH keys.
But if you can push, it might be because:
you are using an HTTPS URL
your work account credentials were cached (git config credential.helper: probably credential-osxkeychain on Mac: see "clear all Git credentials").

github desktop error “The repository does not seem to exist anymore. You may not have access, or it may have been deleted or renamed.”

I have installed GitHub Desktop as the uploaded local project tool, I uploaded a project "F:/test", and it could show successful in my GitHub homepage, then I delete this repository.
But I re-publish this project to GitHub.
Github Desktop shows this history of the repository, and prompt error
The repository does not seem to exist anymore.
You may not have [enter access, or it may have been deleted or renamed
How can I get past this error message?
This error was keeps on occurring to me. Turn out I was not added as the Contributor on the GitHub project.
The repo owner should be able to see and list of Contributor for the project. You can request him to add you in contributor list and this error will disappear.
I was facing the same issue, I simply sign out from Github Desktop app in File > options > Signout
In my case I accidentally changed the push Url, so I executed:
git remote set-url --push origin https://github.com/username/repo.git
After that I checked with:
git remote show origin
your Fetch Url and Push Url must look like the same URL where you cloned the project.
As shown in this error, it is the result of an invalid local path. Either because it includes invalid characters, or because you don't have write/admin access to it (read access is not enough).
If you can, clone again that repo in a different path and open it with GitHub Desktop, and see if the issue persists.
I had the same issue. I deleted my repository from remote as well and then recreated.
If you aren't worried about the change trace being lost, then you can simply remove the .git folder (you will need to enable hidden files in windows) and then re-initialize the repository in the project folder.
This resolved the problem for me!
In my case I have used more than one account. Just sign out from GitHub Desktop and sign in back to the specific account. You might sign out any logged GitHub session on the default web browser if the account is not what you want.
Since I had a forked repository, I had spelled my url wrong in
github desktop -> repository -> repository settings...
I had a link called github.com/myname/myproject.it
but instead of it I hade to write git.
github.com/myname/myproject.git
I was logged in with the wrong account! I had to sign out of Github in the browser first, then sign out in Github Desktop and re-sign in

GitKraken won't let me clone from a private repo on GitHub

I've tried cloning a private repo (that I have access to) on GitHub and get this message:
Clone Failed
Could not connect to 'origin'. Double-check your remote url, then make sure you have access to do that action on that remote and try again.
I run Windows 10, I have connected Kraken to GitHub and ssh key works and I can push and pull repos to my other GitHub repos that are public just fine.
I was also able to clone the repo from the command line just fine.
For some reason, GitKraken does not use your existing HTTPS credentials to communicate with GitHub, nor does it use SSH on Windows. Instead it uses OAuth2, which means you need to grant OAuth2 access to GitKraken.
https://support.gitkraken.com/integrations/github
If no remotes or repositories are appearing in Add Remote or Clone, the likely cause is the need for an organization to allow access. GitKraken cannot see those repos when cloning or adding a fork unless the org specifically gives permission to GitKraken as an application.
First check to see if access is allowed to GitKraken from GitHub Applications
If access has been allowed, then the organization will need to allow Organization Approval
For details about third-party application restrictions view Third-party apps list
These are the steps I took and they worked for me:
You need to be an administrator in your GitHub Organization.
Access the GitHub GitKraken Application page and request access:
https://github.com/settings/connections/applications/a7557949433b7d282a76
You will see a list of your Organizations at the bottom. Click "Request access" if applicable.
If your Organization is not listed then you have other problems (are you using the correct GitHub user account? Are you a member of the Organization?)
This is what the page looks like for me:
Approve of the Access you just requested:
Access this page: https://github.com/organizations/YOUR_ORG_NAME/settings/oauth_application_policy
You can also access the page by going GitHub Settings > "Organization settings" > "Third-party access"
This page looks like this:
This is not the same page as your "Personal settings" > "Authorized applications" page ( https://github.com/settings/applications )
You should see GitKraken listed as requesting permission.
Click the Approve link to grant it access.
GitKraken should work now.
However, in my experience I don't reliably see the GitKraken request listed in the Requests list. I've contacted GitKraken Support for assistance.
You can use the "GitHub Enterprise" configuration instead of the "GitHub.com" configuration:
As the domain for your GitHub enterprise server just enter "GitHub.com".
Generate a personal access token.
This will work with all repos you have access to, even if the organization has not opted-in to allowing OAuth 2 apps to access them, and it works regardless of which version of GitKraken you're using (i.e. you don't need "Pro").
I had the same issue. I solved by disconnecting from my GitHub.com account in GitKraken. Then, when I tried to clone an organizational private repo, GitKraken asked me username and password. The repo was cloned successufuly.
The above answers are all correct, and granting access to your Github organization is still the recommended way to go if you want to take full advantage of GitKraken's features, but if your organization admins can't or won't grant access, Gitkraken supports SSH keys as well.
It'll only use them on existing repos if the URL of the remote is an SSH url (starts with ssh:), and it'll only clone over SSH if you allow it to generate its own SSH key. Go to Preferences > authentication > Github, and it should be able to clone any repo you have access to.