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").
Related
My question is the same as Github add SSH key from others will grant access to all repos?, except my use case is that I am working on a shared server with other contributors. We all need access to a certain repository on this server. However, since GitHub requires SSH now, how can I clone and use the repository without adding my SSH key to the server and allowing everyone else access to all of my personal repositories?
I have already added my teammates as contributors in the repo we want to clone; it would be nice if we could each individually use our username and passwords to interface with the repo (like the old HTTPS method of cloning git repositories) without having to share our private keys with each other. If there is an option to only allow SSH access to a specific repo, that would be nice as well.
The only workaround I can think of right now is to create a dummy GitHub account with the sole purpose of accessing this repo, and registering our SSH key with that GitHub account. But this seems very contrived and I'm wondering if there is a better solution to this problem.
A dummy github account with only the right permissions to access the one repo is what GitHub calls a Machine Account and is the recommended way to provide access under scenarios like these.
Alternatively, you could use a deploy token, those are bound to a single repo by default.
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
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.
We are having an issue with syncing on Github Desktop.
We have a team of 4 members and a company setup in Github.
One of our members can sync the repos he has already worked on before but when I create a new repo for our company, so all members can access it, I can sync but one of the members who is working on the project keeps getting an error
https://github.com/companyname/reponame.git/ doesn't seem to exist any more.
You may not have access, or it may have been deleted or renamed
I have tried to research this but not been able to get any direction, where to go?
Thank you everyone for posting and helping.
I have found the solution and it's a big oversight on my part.. Remember when you create a Repo with team member access, you MUST give then access to WRITE as Git sets default to READ only. When syncing, git desktop does not make it clear that its a permissions issue..
Here is where the READ/WRITE permissions are located on the Github site once you are logged in.
Thank you all.
Double-check that:
the right account for that user has been added as a collaborator for your repo (or your GitHub organisation).
said user is not using a credential helper which would have cached another GitHub account
git config credential.helper
This seems like a simple question which should have a simple answer...
I'm trying to checkout a GitHub project. The project is owned by someone else, so someone else is the Owner. GitHub Collaborators have read/write access, and I have been granted collaborator rights on the project. Collaborators are slightly different than Contributors, who have simply provided a pull request in the past.
I'm trying to avoid the following because I do not want the source files in "read-only" mode:
git clone https://github.com/user/project.git
I feel like I need to identify myself, and send my password or SSH key. But GitHub's help at Which remote URL should I use? only discusses SSH in the context of a Desktop client. I guess they have an app they want me to use, but I don't really want to use one.
Note: I have information in Git's global config (user.name and user.email), but its not the correct information/credentials for these purposes.
How do I checkout a GitHub based project as a Collaborator from the command line?
Using the the HTTP endpoint instead of the the SSH one.
As an aside, when you say checkout do you mean clone, fork or pull?
for clone it would be similar to this:
git clone https://github.com/user/project.js.git
You will be prompted for your user name and password.