Github Pro: How to give read only access to a private repository? - github

We have a Github pro account and have a Github repository for which we want to give read-only access to a few people. They should be able to get the code with this access but shouldn't be to modify this repository in any way.
Is this possible?

If your goal is to allow them to clone the repository but still modify it on their own system, you can do this by either assigning them as collaborators on the repository with the read privilege under Settings → Manage Access.
If your goal is to prevent them from modifying the repository even on their own systems once it's cloned, then that isn't possible.

Related

Copy all repos of an organisation to another account

I'm part of an organisation on github and would like to copy all the repos of that organisation to another regular github account at once.
I thought there would be a tool to help me to do this easily but haven't found one yet. What would be the easiest way to approach this? Thank you
I have tried looking into gh but I'm not sure it's the right tool for it. All I'm trying to do is basically cloning all the repos of the organisation I am a part of to another github account in one go
I have tried looking into gh but I'm not sure it's the right tool for it.
Considering there does not seem to be a native feature allowing for a bulk copy you want, gh is actually a good option.
Depending on the fork policy of your organization and the nature of said repositories (public or private), you should be able to write a script, using the GitHub CLI gh, which would:
list the repositories of an organization (gh repo list)
fork it (gh repo fork)
Note that will not copy issues or pull-requests.

GitHub - How to clone repository on a shared server without giving access too all my repos

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.

GitHub - Exclude certain repository from collecting contributions which is showed in my profile

I'm using Settings Repository to sync my settings between multiple environments. Whenever I open/close my IDE, it automatically sync local data with remote and makes a new commit.
The problem is, in my GitHub profile, those commits are collected as private contributions. So the number of contributions is too high than what I've actually done.
Is there a way to hide or remove contributions from certain repository? Or should I use another git host? (like GitLab)
There is a Profile Setting whether or not to include commits to private repos in your stats.
I don’t know of a per-repo setting.

github desktop not allowing sync to remote repository - no access or repo deleted or renamed

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

github limited access to project folders

I have a github repository with few folders in it. What I would like to achieve is that I want to provide access to shared users to only particular folders. How can I achieve this?
I think using a Git submodule might give you what you want here. Submodules behave like repositories which effectively live inside of another repository. You could place the shared code into a submodule and then only grant permission to this section of the parent repo for shared users. Your shared users would not have permission to the outer parent repo.
Have a look here for more information: Does GitHub have built-in support for submodules?