{
    "mode": "man",
    "parameter": "apt-add-repository",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/apt-add-repository/1/json",
    "generated": "2026-06-03T01:49:33Z",
    "synopsis": "add-apt-repository [OPTIONS] [LINE]",
    "sections": {
        "NAME": {
            "content": "add-apt-repository    -    Adds    a    repository    into   the   /etc/apt/sources.list   or\n/etc/apt/sources.list.d or removes an existing one\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "add-apt-repository [OPTIONS] [LINE]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "add-apt-repository  is  a  script  which  adds  an  external   APT   repository   to   either\n/etc/apt/sources.list  or  a  file in /etc/apt/sources.list.d/ or removes an already existing\nrepository.\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Note that the --list, --ppa, --cloud, --uri, --sourceslist, and LINE parameters are  mutually\nexclusive; only one (or none) of them may be specified.\n",
            "subsections": [
                {
                    "name": "-h, --help",
                    "content": "Show help message and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-d, --debug",
                    "content": "Print debug information to the command line.\n",
                    "flag": "-d",
                    "long": "--debug"
                },
                {
                    "name": "-r, --remove",
                    "content": "Remove the specified repository.\n\nThis  first  will  disable  (comment  out) the matching line(s), and then any modified\nfile(s) under sources.list.d/ will be removed if they contain only empty and commented\nlines.\n\nNote that this performs differently when used with the --enable-source and/or --compo‐\nnent parameters.  Without either of  those  parameters,  this  removes  the  specified\nrepository,  including any deb-src line(s), and all components.  If --enable-source is\nused, this disables only the 'deb-src' line(s).  If --component is used, this  removes\nonly  the specified component(s), and only removes the repository if no components re‐\nmain.\n\nIf both --enable-source and --component are used with --remove, the actions  are  per‐\nformed  separately:  the specified component(s) will be removed from both deb and deb-\nsrc lines, and deb-src lines will be disabled.\n",
                    "flag": "-r",
                    "long": "--remove"
                },
                {
                    "name": "-y, --yes",
                    "content": "Assume yes to all queries.\n",
                    "flag": "-y",
                    "long": "--yes"
                },
                {
                    "name": "-n, --no-update",
                    "content": "After adding the repository, do not update the package cache.\n",
                    "flag": "-n",
                    "long": "--no-update"
                },
                {
                    "name": "-l, --login",
                    "content": "Login to Launchpad (this is only needed for private PPAs).\n",
                    "flag": "-l",
                    "long": "--login"
                },
                {
                    "name": "-s, --enable-source",
                    "content": "Allow downloading of the source packages from the repository.\n\nThis adds and enables a 'deb-src' line for the repository.\n\nIf this parameter is used without any repository, it will enable all currently  exist‐\ning disabled source repository (deb-src) entries that have a corresponding enabled bi‐\nnary repository (deb) entry.\n\nIf this parameter is used twice without any  repository,  it  will  also  add  missing\nsource repository entries for all existing binary repository (deb) entries.\n",
                    "flag": "-s",
                    "long": "--enable-source"
                },
                {
                    "name": "-c, --component",
                    "content": "Which component(s) should be used with the specified repository.\n\nIf not specified, this will default to main.  This may be used multiple times to spec‐\nify multiple components.\n\nIf this is used without any repository, it will add the component(s) to all  currently\nexisting (enabled) repositories, but only if listed in the main sources.list file.\n",
                    "flag": "-c",
                    "long": "--component"
                },
                {
                    "name": "-p, --pocket",
                    "content": "What pocket to use.\n\nDefaults to none, which is equivalent to the release pocket.\n\nIf this is used without any repository, it will add the pocket to all currently exist‐\ning repositories, but only if listed in the main sources.list file. It  will  use  the\ncomponents  currently  configured with the release pocket, or if that is not currently\nconfigured, it will use the main and restricted components.\n",
                    "flag": "-p",
                    "long": "--pocket"
                },
                {
                    "name": "--dry-run",
                    "content": "Show what would be done, but don't make any changes.\n",
                    "long": "--dry-run"
                },
                {
                    "name": "-L, --list",
                    "content": "List currently configured repositories.\n\nThis will only list enabled repositories; it will not show disabled repository lines.\n\nBy default, this shows only binary (deb) repositories.   If  --enable-source  is  also\nused, this will also show source (deb-src) repositories.\n",
                    "flag": "-L",
                    "long": "--list"
                },
                {
                    "name": "-P, --ppa",
                    "content": "Add an Ubuntu Launchpad Personal Package Archive.\n\nMust be in the format ppa:USER/PPA, USER/PPA, or USER.\n\nThe  USER parameter should be the Launchpad team or person that owns the PPA.  The PPA\nparameter should be the name of the PPA; if not provided, it defaults to 'ppa'.\n\nThe GPG public key of the PPA will also be downloaded and added to apt's keyring.\n\nTo add a private PPA, you must also use the --login parameter, and of course you  must\nalso be subscribed to the private PPA.\n",
                    "flag": "-P",
                    "long": "--ppa"
                },
                {
                    "name": "-C, --cloud",
                    "content": "Add an Ubuntu Cloud Archive.\n\nMust be in the format cloud-archive:CANAME, uca:CANAME, or CANAME.\n\nThe  CANAME  parameter  should be the name of the Cloud Archive.  The CANAME parameter\nmay optionally be suffixed with the pocket, as either -updates or -proposed.   If  not\nspecified, the pocket defaults to -updates.\n",
                    "flag": "-C",
                    "long": "--cloud"
                },
                {
                    "name": "-U, --uri",
                    "content": "Add an archive, specified as a single URI.\n\nIf the URI provided is detected to be a PPA, this will operate as if the --ppa parame‐\nter was used.\n",
                    "flag": "-U",
                    "long": "--uri"
                },
                {
                    "name": "-S, --sourceslist",
                    "content": "Add an archive, specified as a full source entry line in one-line sources.list format.\n\nThis must follow the ONE-LINE-STYLE format as described in the sources.list manpage.\n\nIf the URI provided is detected to be a PPA, this will operate as if the --ppa parame‐\nter was used.\n\n",
                    "flag": "-S",
                    "long": "--sourceslist"
                }
            ]
        },
        "LINE": {
            "content": "LINE  is a deprecated method to specify the repository to add/remove, provided only for back‐\nwards compatibility.  It can be specified in any of the supported formats: sources.list line,\nplain  uri, ppa shortcut, or cloud-archive shortcut.  It can also be specified as one or more\nvalid component(s).  The script will attempt to detect which format is provided.\n\nThis is not recommended as the autodetection of which line format is intended can be  ambigu‐\nous, but older scripts may still use this method of specifying the repository.\n\nOne special case of LINE is providing the value -, which will then read the LINE from stdin.\n\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "add-apt-repository -P ppa:user/repository\n\nadd-apt-repository -P user/repository\n\nadd-apt-repository -C cloud-archive:queens\n\nadd-apt-repository -C uca:queens\n\nadd-apt-repository -C queens\n\nadd-apt-repository -S 'deb http://myserver/path/to/repo stable main'\n\nadd-apt-repository -S deb http://myserver/path/to/repo stable main\n\nadd-apt-repository -U http://myserver/path/to/repo -c main\n\nadd-apt-repository -U https://packages.medibuntu.org -c free -c non-free\n\nadd-apt-repository -U http://extras.ubuntu.com/ubuntu\n\nadd-apt-repository -s\n\nadd-apt-repository -L\n\nadd-apt-repository -s -r\n\nadd-apt-repository -c universe\n\nadd-apt-repository -r -c multiverse\n\n",
            "subsections": []
        },
        "DEPRECATED EXAMPLES": {
            "content": "add-apt-repository deb http://myserver/path/to/repo stable main\n\nadd-apt-repository http://myserver/path/to/repo main\n\nadd-apt-repository https://packages.medibuntu.org free non-free\n\nadd-apt-repository http://extras.ubuntu.com/ubuntu\n\nadd-apt-repository multiverse\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "sources.list(5) apt-get(8)\n\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "This  manual  page  was  written by Chow Loong Jin <hyperair@gmail.com> for the Debian system\n(but may be used by others). Permission is granted to copy,  distribute  and/or  modify  this\ndocument  under  the  terms of the GNU General Public License, Version 2 or any later version\npublished by the Free Software Foundation.\n\nOn Debian systems, the complete text of the GNU  General  Public  License  can  be  found  in\n/usr/share/common-licenses.\n\n\n\nadd-apt-repository(1)",
            "subsections": []
        }
    },
    "summary": "add-apt-repository    -    Adds    a    repository    into   the   /etc/apt/sources.list   or /etc/apt/sources.list.d or removes an existing one",
    "flags": [
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Show help message and exit."
        },
        {
            "flag": "-d",
            "long": "--debug",
            "arg": null,
            "description": "Print debug information to the command line."
        },
        {
            "flag": "-r",
            "long": "--remove",
            "arg": null,
            "description": "Remove the specified repository. This first will disable (comment out) the matching line(s), and then any modified file(s) under sources.list.d/ will be removed if they contain only empty and commented lines. Note that this performs differently when used with the --enable-source and/or --compo‐ nent parameters. Without either of those parameters, this removes the specified repository, including any deb-src line(s), and all components. If --enable-source is used, this disables only the 'deb-src' line(s). If --component is used, this removes only the specified component(s), and only removes the repository if no components re‐ main. If both --enable-source and --component are used with --remove, the actions are per‐ formed separately: the specified component(s) will be removed from both deb and deb- src lines, and deb-src lines will be disabled."
        },
        {
            "flag": "-y",
            "long": "--yes",
            "arg": null,
            "description": "Assume yes to all queries."
        },
        {
            "flag": "-n",
            "long": "--no-update",
            "arg": null,
            "description": "After adding the repository, do not update the package cache."
        },
        {
            "flag": "-l",
            "long": "--login",
            "arg": null,
            "description": "Login to Launchpad (this is only needed for private PPAs)."
        },
        {
            "flag": "-s",
            "long": "--enable-source",
            "arg": null,
            "description": "Allow downloading of the source packages from the repository. This adds and enables a 'deb-src' line for the repository. If this parameter is used without any repository, it will enable all currently exist‐ ing disabled source repository (deb-src) entries that have a corresponding enabled bi‐ nary repository (deb) entry. If this parameter is used twice without any repository, it will also add missing source repository entries for all existing binary repository (deb) entries."
        },
        {
            "flag": "-c",
            "long": "--component",
            "arg": null,
            "description": "Which component(s) should be used with the specified repository. If not specified, this will default to main. This may be used multiple times to spec‐ ify multiple components. If this is used without any repository, it will add the component(s) to all currently existing (enabled) repositories, but only if listed in the main sources.list file."
        },
        {
            "flag": "-p",
            "long": "--pocket",
            "arg": null,
            "description": "What pocket to use. Defaults to none, which is equivalent to the release pocket. If this is used without any repository, it will add the pocket to all currently exist‐ ing repositories, but only if listed in the main sources.list file. It will use the components currently configured with the release pocket, or if that is not currently configured, it will use the main and restricted components."
        },
        {
            "flag": "",
            "long": "--dry-run",
            "arg": null,
            "description": "Show what would be done, but don't make any changes."
        },
        {
            "flag": "-L",
            "long": "--list",
            "arg": null,
            "description": "List currently configured repositories. This will only list enabled repositories; it will not show disabled repository lines. By default, this shows only binary (deb) repositories. If --enable-source is also used, this will also show source (deb-src) repositories."
        },
        {
            "flag": "-P",
            "long": "--ppa",
            "arg": null,
            "description": "Add an Ubuntu Launchpad Personal Package Archive. Must be in the format ppa:USER/PPA, USER/PPA, or USER. The USER parameter should be the Launchpad team or person that owns the PPA. The PPA parameter should be the name of the PPA; if not provided, it defaults to 'ppa'. The GPG public key of the PPA will also be downloaded and added to apt's keyring. To add a private PPA, you must also use the --login parameter, and of course you must also be subscribed to the private PPA."
        },
        {
            "flag": "-C",
            "long": "--cloud",
            "arg": null,
            "description": "Add an Ubuntu Cloud Archive. Must be in the format cloud-archive:CANAME, uca:CANAME, or CANAME. The CANAME parameter should be the name of the Cloud Archive. The CANAME parameter may optionally be suffixed with the pocket, as either -updates or -proposed. If not specified, the pocket defaults to -updates."
        },
        {
            "flag": "-U",
            "long": "--uri",
            "arg": null,
            "description": "Add an archive, specified as a single URI. If the URI provided is detected to be a PPA, this will operate as if the --ppa parame‐ ter was used."
        },
        {
            "flag": "-S",
            "long": "--sourceslist",
            "arg": null,
            "description": "Add an archive, specified as a full source entry line in one-line sources.list format. This must follow the ONE-LINE-STYLE format as described in the sources.list manpage. If the URI provided is detected to be a PPA, this will operate as if the --ppa parame‐ ter was used."
        }
    ],
    "examples": [
        "add-apt-repository -P ppa:user/repository",
        "add-apt-repository -P user/repository",
        "add-apt-repository -C cloud-archive:queens",
        "add-apt-repository -C uca:queens",
        "add-apt-repository -C queens",
        "add-apt-repository -S 'deb http://myserver/path/to/repo stable main'",
        "add-apt-repository -S deb http://myserver/path/to/repo stable main",
        "add-apt-repository -U http://myserver/path/to/repo -c main",
        "add-apt-repository -U https://packages.medibuntu.org -c free -c non-free",
        "add-apt-repository -U http://extras.ubuntu.com/ubuntu",
        "add-apt-repository -s",
        "add-apt-repository -L",
        "add-apt-repository -s -r",
        "add-apt-repository -c universe",
        "add-apt-repository -r -c multiverse"
    ],
    "see_also": [
        {
            "name": "sources.list",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/sources.list/5/json"
        },
        {
            "name": "apt-get",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/apt-get/8/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "This command is an alias of `add-apt-repository`.",
        "examples": [
            {
                "description": "View documentation for the original command",
                "command": "tldr add-apt-repository"
            }
        ]
    }
}