Cannot enable forking on github repo - github

I have a private repo. I noticed I cannot fork it. I cannot find any information that says I shouldn't be able to. When I go to Options the ability to fix this is disabled. I am guessing you need to pay or something which is fine, but it doesn't say that anywhere...
Cannot click!

I think you are talking about your organisation's private repo, right? As I didn't find this checkbox for personal private repositories.
If so, then you need to:
go to your organisation's settings, Member privileges, and check "Allow forking of private repositories" there.
go to your repo and you'll see "Allow forking" will be automatically checked after doing step 1, like this.
The process is also described here:
https://docs.github.com/en/organizations/managing-organization-settings/managing-the-forking-policy-for-your-organization

As of 1/9/2022, I had to update "Member Privileges" in the Organization first:
And then, in the repository it seemed to automatically allow forking. Just note that you might want to update any other repository that you shouldn't be forked.
References:
https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/setting-base-permissions-for-an-organization
https://github.community/t/private-repositories-option-grayed-out-under-member-privileges-in-my-organization/2029/6

Related

how to allow 3rd party to create repo (repo transfer) in our Org without let them see our private repo?

We have hired a 3rd party to work on a project, we started by not creating any Repo on our Github, but they started with their Repo. So now it's time to transfer the repo. However, in order to transfer the repo, the developer is asking permission to create a Repo in our Org... but as far as I know, I can only invite him first as a collaborator, a member, before he can create any private repo in our Org... that means he can see our other repo...
I couldn't find any good answer online, please help. Thanks!
Have you tried using Github's Organization features? You can create an organization with your team members in it, and control who has access to what.
Here's a Github page that explains a bit more about how it works.
Do not add them as a member to your Org! (this is the only option today from Github, nor owners...of course). If you do so, this will give your external developer access to all of your repos.
The only way I found you can safely invite an external user is to create a Repo first, then add them in that Repo. By doing that, they will be invited only to that repo, and have no access to the others.
This is my workaround. If you have a better solution, please do comment. I am curious how the "transfer" feature works.

Issues if migrating a repository to a Github organisation then forking the repo?

I have a Github repository, lets call it:
http://github.com/LegoStormtroopr/ExampleRepository
I want to hand ownership of this repository over to an Organisation to get:
http://github.com/MyCoolOrg/ExampleRepository
But, I want to keep working on the code on my own fork. If I forked this code, I'd once again have a repository with the address:
http://github.com/LegoStormtroopr/ExampleRepository
In effect, I'd move the upstream to the organisation, make forks in a local github fork, and then be able to issue pull requests to the organisation.
I'd like to do this with the least hassle and breakages, and the documentation on what happens after a repository is handed over is a little hazy.
Are there any serious issues that will happen as a result of shifting the repository like this? Will things break because a repository that was there disappeared for a short time?
So having just given this a shot, it appears there are no issues when doing this. However a few things to note:
The organisation cannot have a previous fork of the repository. This prevents it from being able to take ownership.
If you transfer the repository to the organisation, and then fork this into your own account, any working copies of this don't need to be updated, however changes you make will be pushed into your repository, not the organisations.
You may need to reconfigure third-party applications (like Travis-CI and Coveralls) to work with the new organisation, but this is straight forward:
From your account, go to settings and select Applications:
Find the application you need to reconnect (for example Travis-CI) and click View:
Next to each orgnaisation there will be a button titled Grant (not shown because I've already clicked it):
To get Coveralls working properly, in addition to the above, you also need to:
Set your visibility in the organisation to Public:
Refresh the list of repositories in Coveralls (ignore the button name, it syncs public and private repositories):
Lastly, to retain your coverage history, in Coveralls in your old repository select "Change source" and in the list select the corresponding repository in your new organisation.
And now your organisation is all set!

Link private github repository to potential employer

I have some private github repos that contains the work that I am most proud of. I would like potential employers to see this code. Is it possible for me to give them a link to the private repository so they can view my work?
You could either:
create a private repo in bitbucket and push your project there, then send an invitation to employers' emails
add potential employers as collaborators to your private Github repo.
On the main repo's page, go to the "Settings" tab
On the nav links to the right, "Collaborators"
I'd recommend against zipping the project and sending them the whole thing, as they'd either not see the git history, or see your entire git configuration, depending on how you zip the folder... And I think seeing how a developer works with git is important in addition to seeing the code itself...
There are few option for you:
If you have private repositary on your machine, then public into bitbucket or github and making private repo.
If you have private repositary online you can invite them to the repositary and give them privilages that you want to.
Make latest backup of your repositary and send it to them.
Hope it helps.

Can the owner of a repo see clones?

I know that the owner of a repo is able to see a fork request when one is performed. But what about a clone? Can the owner of the repo see when someone clones it?
The question is too general, but let me answer the question as it stands now.
Can the owner of the repo see when someone clones it?
No, they cannot. If I go to one of your repositories and clone it to my local hard drive, the owner will not be able to view that activity. And why would you want to? Likely there are many clones of your repository.
Know that clones can live on other systems than GitHub.
Now, will the owner know that someone forked their repository on GitHub itself?
Yes, they will, assuming they pay attention.
I did the following:
Logged in as my main account
Created a repository
Set up a new dummy-account on an alternate email address
Forked the repository I created earlier
Logged back into my main account
This is what I see on my first page after logging in:
If I do the following:
Click on my repository
Click on the small 1 to the right of the "Fork" button:
Click on the "Members" tab:
Then I see this:
Conclusion:
Yes, the owner of a repository will see when someone makes a fork on GitHub, but no, they will not see it when someone makes a clone somewhere else.
As far what I found you CAN'T know when someone clones it (if you mean exact time) nor who cloned it.
But you can know how many clones were made on which date and the number of unique cloners from ths url.
https://github.com/{usernamme}/{reponame}/graphs/traffic
Insights tab:
However one thing I find fishy is unique cloners is more than unique visitors, how can someone decide to clone even without visiting the repo. I guess it may be bots in such cases.
You can use clone graph on GitHub to find out how many times your repository's source code is actually cloned in a given day. More information can be found here https://help.github.com/articles/about-repository-graphs/#traffic
Yes, it can be done.
Go to your account landing page- https://github.com/yourusername
Click on the repo you want to check traffic for.
Click on Insights on top navigation bar.
Click on Traffic on left navigation bar.
Voila, you will get your traffic including no of clones with a timeline.
Reference: clone graph
Open Github, find your repo, click on it. Then click on Insights and finally click on Traffic. Github shows a graph Traffic including git clones. Salutes!
As for now we can obtain this information with Rest API /audit-log,
but it is available only for Enterprise users with org:read permission.
We can see the actual users that have preformed fetch, clone and many more actions.
https://docs.github.com/en/rest/reference/orgs#get-the-audit-log-for-an-organization
as long as you have access to the repo, aka an ssh key on the filesystem with the remote, then yes. you would do as follows:
git fetch some_remote
git log some_remote/some_branch

How do I make a readonly mirror of my github repo?

We need to have a read only github repo that mirrors our main branch.
I've noticed castle have managed to do it with their entire collection of repositories.
How would I go about achieving this?
Castleproject is an organization (also mentioned here) in order to restrict write access.
That is why you see read-only addresses on their projects.
That also means it (ie the organization "castleproject") can add users with read-only rights.
As a simple user owning a GitHub repo, you wouldn't have access to that feature.
You need to define an "organization".
I believe this is what you are looking for right here:
http://justcramer.com/2011/05/09/creating-a-one-way-git-server-mirror/