How to give someone access to a private repository while still allowing me to be the single owner? - github

I have project on Github of which I need help with. It started out as a personal project and now evolved to me incorporating a company and hiring someone. How can I give this person access so that they cannot delete anything and only I will be allowed to accept their code changes or not?
This is a personal github account and the repository is private.

Since the account is a personal account, you will be the owner unless you explicitly transfer ownership. Anyone you give access to will be a collaborator. They cannot access repository settings, add or remove collaborators, or delete the repository, for instance.
However, GitHub does not provide fine-grained permission controls for collaborators of repositories from personal accounts. You cannot prevent them from having write access. This help page provides a list of things collaborators can do in the repository.
You can (partly) achieve what you want by protecting your master branch and requiring reviews for pull requests.
For more fine-grained access control, you could create an organization account and transfer the repository there, and keep yourself as the sole user with admin permissions. You can then give your collaborator only read permissions.

Related

GitHub Personal Access Token Private repo scope

I am currently trying out Netlify function and using Netlify-cli to setup the CD. In the authorizing options, I picked the GitHub Personal Access Token and I want to know if the Full control of private repositories scope will include the private repos in the organization that I am apart of as I don't want it to access the repos in the organization.
The scope has a few implications and you should probably look at a user specific role for setting up access tokens without giving access to a user (yourself) as the owner of the org repositories you have.
Create a (machine) user that has access to only the one repository or repositories (private) that would limit the access to these repositories or an organization repository. Since private tokens have read/write access this is a prudent approach to making sure you're limiting access to other repositories using the token.
If at a later time this changes on Github, this will no longer be needed. It is the approach I have used to limit my exposure to a leaked token or access.

How to setup Azure DevOps Repo Read Only Access

Objective: Allow different clients access to only read/pull from my private repo.
Overview:
Listed are the different options that I am aware of:
I could invite the clients and give them access to the Basic access level but do know what to have to pay for different users just to read/clone from the repo.
I could create a single user with Basic access level and then create git access tokens for them individually. However, I did not see a way to restrict the access tokens to be project/repo specific. Instead, the access tokens create had the same privileges as the created user.
Question: What is the best practice to provide access to an external user to only access the private Azure DevOps repo?
Note: I have seen this link and did not know if there were other options.
To make the user only have read access to all repos in one project:
You may consider making the user a reader instead of contributor or Project Administrators, so the user can have only read access to the repos in one project.
Organization Settings=>Users(General)=>Manage user=> select Project reader.
More details about project readers you can check this document.
To make the user only have read access to one special repos in one project:
We can control related permissions from Project Settings=>Repositories(Repos)=>Version Control Administrators:
Hope all above helps :)

GitHub how to give a user admin access based on repo's tags

Is it possible to give a specific user admin access to certain repositories in your organisation based on their tags?
I'm trying to give a member admin access specifically to several repositories (10+) related to a group of projects, but not all repositories. I can manually do that but I wonder if there's a more efficient way.
I haven't been able to find the answer anywhere.
I'm unaware of a way to grant permissions by repository tags, but a GitHub Team would be a good option for this.
Create a new GitHub Team, give it appropriate access to the 10+ repositories, and then assign the member admin to that team. They should then be able to administrate only the added repositories.

Github permissions

We've set up a Github app so that it automatically forks a repository for another individual Github user using the Github API. Now we're running into a problem that not everyone wants to give us full read access to all of their private repositories since sometimes they contain sensitive data.
Is there a way to only get read/write permission to a single repository and not the individual's entire account?
Unfortunately, this is not available yet. This feature is still under development as you can see in the Gihub Apps roadmap (and note that I am talking about Github Apps, not OAuth Github Apps). I don't know if this will ever be possible in OAuth Apps but it seems that it might in Github Apps.
There is already a discussion about this at the dear github repository. You should check for news there.
Is there a way to only get read/write permission to a single repository and not the individual's entire account?
Not that I know of: it is easier to setup a new dedicated GitHub account where you would recreate the private repos you want to give access to.
In that new account, you can consider all the private repos can be accessed.
You would keep the really private ones (with sensitive information) in your original GitHub account.
I believe you're looking for X-OAuth-Scopes. This is a well-defined header so that you may restrict your access scope to, for example, public repositories only.
The github developer documentation here says:
... space-delimited list of scopes. If not provided, scope defaults to an empty list for users that have not authorized any scopes for the application. For users who have authorized scopes for the application, the user won't be shown the OAuth authorization page with the list of scopes. Instead, this step of the flow will automatically complete with the set of scopes the user has authorized for the application. For example, if a user has already performed the web flow twice and has authorized one token with user scope and another token with repo scope, a third web flow that does not provide a scope will receive a token with user and repo scope.

Why would github application ask write access to my private repo?

I'm signing up a website with my github account. But why would github allow application gain access to my private repo?
What I expect is that github should allow me to control which access I want to grant to that application.
This application will be able to read
and write all public and private repository data. This includes the
following:
Code
Issues
Pull
requests
Wikis
Settings
Webhooks and services
Deploy keys
Github's permissions are, unfortunately, not all that granular.
They're listed here: https://developer.github.com/v3/oauth/#scopes
The site is presumably requesting the repo permission. It'd be nice if Github let you pick and choose which repositories to allow a third-party application access to, but it's currently all-or-nothing.
The site may or may not have a legitimate need for that permission (a CI service might need access to a private repo, for example). We can't answer that part for you - you'll have to decide for yourself if the login is worth the risk.