108

When I create a new repository in a Github organization, all the organization owners get automatically subscribed to that repository's notification.

I'm going to be making a lot of repositories for archival purposes. I would like to turn auto subscribe off, not just for me but for everyone in the org. I would also like to avoid sending out the initial "you have been automatically subscribed" email. I can't find anything in the Github API or organization settings to do this.

Hey there, we're just writing to let you know that you've been automatically subscribed to a repository on GitHub.

    gitpan-test/Acme-LookOfDisapproval created by gitpan-test-account
    Read-only release history for Acme-LookOfDisapproval
    https://github.com/gitpan-test/Acme-LookOfDisapproval

You'll receive notifications for all issues, pull requests, and comments that happen inside the repository. If you would like to stop watching this repository, you can manage your settings here:

    https://github.com/gitpan-test/Acme-LookOfDisapproval/subscription

You can unwatch this repository immediately by clicking here:

    https://github.com/gitpan-test/Acme-LookOfDisapproval/unsubscribe_via_email/blahblahblah

You were automatically subscribed because you've been given push access to the repository.

Thanks!
3
  • 1
    As a work-around, if the org has a mail server which you control, you could filter the emails out, using the repository name and email format.
    – cowb0y
    Aug 13, 2014 at 22:49
  • @cowb0y The "organization" only exists on Github. The members are from all over the place using different mail servers.
    – Schwern
    Aug 14, 2014 at 3:16
  • I found this to be the best solution. As long as the notification emails come to the same address, you can create a filter (e.g. in gmail) that automatically deletes them.
    – amball
    May 2, 2022 at 17:21

7 Answers 7

101
  1. Go to your profile settings
  2. Click Notification Center
  3. Uncheck Automatically watch repositories
5
  • 25
    Thanks, but that's for all orgs. I want to do it for just one organization I'm an owner/member of.
    – Schwern
    Oct 9, 2015 at 18:19
  • 3
    @Schwern ah sorry I misunderstood.
    – connorbode
    Oct 10, 2015 at 16:25
  • 8
    I know it doesn't answer the OP question, but this was absolutely what I was looking for. Thanks @connorbode! Mar 27, 2016 at 20:55
  • So is it just not possible to turn this rule off on a per-organization basis? Jul 6, 2022 at 18:17
  • yes, see other answers, goto to github.com/watching Jul 21, 2023 at 8:18
27

I love gifs so I created one to show how to deal with this issue.

image

  1. Go to your Settings page on GitHub
  2. Then click at Notifications menu
  3. Just uncheck Automatically watch repositories and you're done.

Peace! ✌️

2
  • 10
    Thank you, it's a lovely GIF. However, I only want to do that for a single organization. Not for all repositories. I'll make the question more clear.
    – Schwern
    Jan 17, 2018 at 3:43
  • I don't suppose that's possible have to look under the org settings. Jan 17, 2018 at 10:20
24

The apacheflex organization has the same issue a year ago, and their conclusion wasn't too promising:

Try unchecking "Automatically watch" at: https://github.com/watching

I tried that, I hope it will work, just I was wondering if it can be done from admin rights in the Apache Flex github repo, that's why I was asking Om

unfortunately there are no Admin settings that lets me do this.
The best approach would be to go unwatch repos you dont want here: https://github.com/watching, like Jose mentioned.
This seems to be a per user setting and not a per organization setting.

You might also uncheck the 'Automatically watch' setting if you dont want to do this every repo that gets created.

Not ideal, but this is the best option we have for now.


This seems to be confirmed by the OP Schwern as detailed in the comments:

I contacted Github tech support and they said much the same thing, to turn off "Automatically watch".
Unfortunately that must be done per org member and it's a global option, not specific to the org.

4
  • I contacted Github tech support and they said much the same thing, to turn off "Automatically watch". Unfortunately that must be done per org member and it's a global option, not specific to the org.
    – Schwern
    Aug 7, 2014 at 7:40
  • @Schwern Yes, that was my conclusion as well, after some research. Hence this answer.
    – VonC
    Aug 7, 2014 at 7:41
  • I'm hoping github fixes this soon. It's HUGE oversight to force your organizational notification settings globally.
    – Just a guy
    Jun 4, 2015 at 16:44
  • 5
    I don't even understand why this is ever desired behavior. If someone forks a repo owned by an organization I am in, why would all the organization members be given push access to the fork? This doesn't happen when people fork repos I own as a single user, rather than via an organization. This is a very annoying "feature", imo. Oct 10, 2015 at 23:37
16

To stop receiving notifications on some of the repos that you have been added to, simply visit this url https://github.com/watching and uncheck/unwatch all the repos you don't want to receive notifications from.

Hope this helps.

5
  • 2
    Thank you for the answer, but this project has thousands of repositories, and can add a dozen a week. Manually unwatching is not practical.
    – Schwern
    Mar 21, 2018 at 21:26
  • 1
    @Schwern, maybe you can do the opposite then? In your Settings/Notifications, uncheck the Automatically watch repositories button. That will unsubscribe you from all repos you've been added. Then for the ones you're interested, you can manually 'watch' them on github.com/watching
    – Kaka Ruto
    Mar 22, 2018 at 9:45
  • Unfortunately that effects all repositories for that account, not just ones for that organization. I normally do want to be auto-subscribed.
    – Schwern
    Mar 22, 2018 at 9:52
  • 2
    I was STILL getting notifications even though I clicked "unwatch" button on the repo directory landing page. So I completely deleted the forked repo hoping that would stop the email notifications, but it didn't. Going in the github.com/watching page and clicking unwatch for that particular repo worked perfectly. Thank YOU!
    – Chris22
    Dec 21, 2020 at 18:41
  • 1
    Great answer - doing this let me easily unwatch the 15k repos I just got automatically subscribed to... (unsubbing was granular as well so I kept my watch status on repos I had watched prior!) Mar 25 at 2:40
3

Check out github-watchlist

It allows regular expression based mass subscribing and unsubscribing for repositories.

Github-watchlist

1
  • Thanks for the answer, but it's not the solution I'm looking for. There's no reason to ever subscribe to notifications for these repositories, all repositories are for archival purposes only. Every member of the organization would have to run and maintain your script. It would not stop the avalanche of automatic subscription emails. We're talking 22,000 repositories (yes I have permission to do this).
    – Schwern
    Aug 3, 2014 at 19:27
1

I'm almost 8 years late but this can be handy.

# Make sure the personal access token has access to notifications & repo
GH_TOKEN=<TOKEN-HERE>
ORGANIZATION=<ORG-NAME>
MAX_REPO_COUNT=5000
repolist=$(GH_TOKEN=$GH_TOKEN gh repo list $ORGANIZATION -L $MAX_REPO_COUNT --json name --jq '.[].name')
echo $repolist | while read repo; do
  echo "Unsubscribing from $ORGANIZATION/$repo\n"
  GH_TOKEN=$GH_TOKEN gh api -H "Accept: application/vnd.github+json" /repos/$ORGANIZATION/$repo/subscription --method PUT -F ignored=true | jq '.'
done
1
  • @schwern I think this solution answers your question! Nov 8, 2022 at 9:10
1

I'd like to complete Rewanth Tammana answer.

  1. The idea to use gh / github apis to automatically unsubscribe repositories is great, however this targets every repo from the organisation and I find it more efficient to rather list the repositories the user subscribed to, with a filter based on the organisation name.
  2. If you're automatically subscribing to lots of new different repositories, chances are you are spammed with notifications as well. If you don't want your notifications inbox to drown, you shall mark them as read (a) & done (b), unsubscribe from them (c).

Unfortunately (b) and (c) cannot be done automatically since there are no available apis to reach with gh to do so (for now).

Here's my solution (link to the gist).

#!/usr/bin/env bash

# GH_TOKEN=
# GITHUB_TOKEN=$GH_TOKEN
# ORGANIZATION=
# LOG_FILE=

exec 3>&1 1>>${LOG_FILE} 2>&1

now=$(date)
echo ">>>> Script started at: $now"
echo ""

gh auth login --with-token <<< $GH_TOKEN

subscribed=($(gh api -H "Accept: application/vnd.github.json" -H "X-GitHub-Api-Version: 2022-11-28" /user/subscriptions --jq '.[].full_name') )
echo ">> Unsubscribe automatically subscribed repositories from $ORGANIZATION"
echo "$subscribed"
for it in "${subscribed[@]}"
do
    if [[ $it == *"$ORGANIZATION"* ]]; then
        gh api \
        --method PUT \
        -H "Accept: application/vnd.github+json" \
        -H "X-GitHub-Api-Version: 2022-11-28" \
        "/repos/${it}/subscription" \
        -F subscribed=false \
        -F ignored=true | jq .
    fi
done
echo ""

echo ">> Cleaning notifications"
gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /notifications --jq '.[].repository.full_name'
notified=($(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /notifications --jq '.[].repository.full_name'))
echo "$notified"
for it in "${notified[@]}"
do
    # Mark them as read. Missing steps :
    # unsubscribe (/notifications/beta/unsubscribe) + done (/notifications/beta/archive)
    if [[ $it == *"$ORGANIZATION"* ]]; then
        gh api \
        --method PUT \
        -H "Accept: application/vnd.github+json" \
        -H "X-GitHub-Api-Version: 2022-11-28" \
        "/repos/${it}/notifications"
    fi
done
echo ""

now=$(date)
echo ">>>> Script ended at: $now"

Eventually turn this into a cronjob if your organisation creates plenty of new repositories every week - which was my case. Logs are obviously optional.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.