Can the owner of a repo see clones?
Asked Answered
A

8

125

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?

Announcement answered 4/1, 2014 at 23:9 Comment(1)
In what way is the question "too general"? The question is very specific and comes up on google many times with this as the top rating answer (kudos to SO). The answer is very informative too.Elroyels
D
106

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:

  1. Logged in as my main account
  2. Created a repository
  3. Set up a new dummy-account on an alternate email address
  4. Forked the repository I created earlier
  5. Logged back into my main account

This is what I see on my first page after logging in:

fork notification

If I do the following:

  1. Click on my repository

  2. Click on the small 1 to the right of the "Fork" button:

    fork button after forking

  3. Click on the "Members" tab:

    members tab

  4. Then I see this:

    content of members tab

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.

Diarmuid answered 4/1, 2014 at 23:16 Comment(9)
How can it be assured that plagiarism doesn't occur then? Is the only way to stop that to make a repo private?Announcement
As long as you allow copying, don't be surprised that someone copies your work. So yes, the only 100% guarantee that nobody copies your work is to make sure they cannot copy it in the first place.Diarmuid
Having said that, this is usually handled by adding licenses to your work. You will always risk that people will disregard your license completely and not give a rats a** about what it says, but then again, can you really do much about those people at all?Diarmuid
Very informative answer! I upvoted your first comment, then accidentally un-upvoted it, and now can't re-upvote =( Rest assured, the final state I wanted was an upvote =)Douglass
Now we can view the clones and other activities on repository. #12851364Gene
why would someone be interested ? I have many many clones and no fork. I am curious of peoples background ...Haskins
@Lasse V. Karisen, if you go to the "Insights" tab at the top of your repo, and then click on "Traffic" in the left pane, you will see how many "Unique Cloners" there are. You will also see how many unique views there are and what domain they came from. So, the OPs question is "yes", you can see when somebody clones your repo, you just can't see who they are.Pilatus
@Pilatus How GitHub identifies the unique cloners?Saraisaraiya
One possible reason why someone would want to see who cloned their repo is when there's a coding challenge for a job application. After sending the link to the hiring manager, the applicant will be curious if his/her submission is already being looked at.Ooze
S
71

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:

enter image description here

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.

Sacrosanct answered 21/12, 2018 at 6:3 Comment(9)
Did you discover why the cloner count is higher than visitor count? May be as simple as someone shared the link to clone the repository. I frequently see this with new repositories and wonder if the cloners are bots instead of people.Clintclintock
@Clintclintock Or maybe users might accidentally clone it twice, maybe it fails for some reason and they try again.World
Why would they create bots to clone random repos ?Abscissa
It could be shared somewhere else, like in a blog post, so people may clone without visiting the repo itself.Sheedy
@giannischristofakis If you are using an API key or have DB passwords or whatever and don't hide it correctly, someone will usually break into your account after you put it on github. I'm assuming there are bots trolling around specifically for this purposeContingent
this is the right answer, as opposed to the accepted one.Virchow
This is why the cloner count is higher than the visitor count.Capello
This tab is not available on GH Enterprise 3.10Fanning
One thing I noticed is whenever I create a docker image of my application, it seems to be getting registered as a unique clone. Especially when doing "docker-compose up --build"Ooze
W
17

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

Westphal answered 28/4, 2016 at 13:34 Comment(2)
But can I see who is cloning my repo?Bedmate
You can only see the clone activity, but not who is cloning your repo. help.github.com/articles/viewing-traffic-to-a-repositoryWestphal
S
16

Yes, it can be done.

  1. Go to your account landing page- https://github.com/yourusername
  2. Click on the repo you want to check traffic for.
  3. Click on Insights on top navigation bar.
  4. Click on Traffic on left navigation bar.

Voila, you will get your traffic including no of clones with a timeline.

Reference: clone graph

Sweatbox answered 2/6, 2018 at 13:13 Comment(0)
A
14

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!

Areaway answered 8/12, 2017 at 23:25 Comment(0)
V
4

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

Vend answered 15/3, 2022 at 10:29 Comment(2)
Do you know the query you would use to look this up I tried curl --location --request GET 'api.github.com/orgs{org}/audit-log?q=action:clone' \ --header 'Authorization: token {{token-here}}' \ --header 'Accept: application/vnd.github.v3+json'Honestly
I've used this query: orgs/{org}/audit-log?include=all&per_page=100 There is no "action" argument, but you can go trough the entries and check for action="git.clone"Vend
P
1

No, the owner of a GitHub repository cannot directly see the number or details of clones performed on the repository. GitHub provides the "Clone" functionality as a way for users to make local copies of a repository, but it does not track or provide visibility into individual clone instances.

Principate answered 18/5, 2023 at 11:9 Comment(1)
Thank you for your interest in contributing to the Stack Overflow community. This question already has quite a few answers—including one that has been extensively validated by the community. Are you certain your approach hasn’t been given previously? If so, it would be useful to explain how your approach is different and/or why you think the previous answers aren’t sufficient. Can you kindly edit your answer to offer an explanation?Gleam
S
-2

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
Sylas answered 4/1, 2014 at 23:14 Comment(3)
oh sorry, orthogonal answer. I missed the 'when someone clones it' partSylas
I didn't get your answer, afaiu git log lists the commits only .Sacrosanct
@JedSchneider, totally out of curiosity, what do you mean by orthogonal answer?Interlude

© 2022 - 2024 — McMap. All rights reserved.