How to know the source repository of a package in debian?
A lot of package include this in their control information in the Vcs-*
fields. You can see it easily (and without downloading the source package) using apt-cache showsrc
.
$ apt-cache showsrc gnome-disk-utility
⋮
Vcs-Browser: https://salsa.debian.org/gnome-team/gnome-disk-utility
Vcs-Git: https://salsa.debian.org/gnome-team/gnome-disk-utility.git
⋮
So in this case, you could do a git clone https://salsa.debian.org/gnome-team/gnome-disk-utility.git
to download the source, or browse it on the web at https://salsa.debian.org/gnome-team/gnome-disk-utility.
Not all packages have Vcs-*
fields. They can be missing because the maintainer doesn't use a VCS (or at least not a public one), or hasn't added the headers for some other reason. apt-get source packagename
will always get the source, though not via a VCS. Similarly, you can browse all the source online at http://sources.debian.net/
(Note: you will need deb-src
lines in your sources.list
file.)
Update: Stephen Kitt points out debcheckout -d
; first time I'd heard of it too. See (and upvote) Stephen Kitt's answer for details.
Using CLI tools
As indicated by derobert, Debian packages which are maintained in a VCS are supposed to indicate this in a pair of Vcs-...
fields in their source package.
The best tool to use this information is debcheckout
in the devscripts
package, or apt-cache showsrc
. Both of these will show you gnome-disk-utility
's repository information.
apt-cache showsrc gnome-disk-utility
will show all the information contained in the source package, including links to the VCS (Vcs-Brower
gives a link for use in a brower, Vcs-Git
give the link to clone the git repository, assuming the repository uses git):
Vcs-Browser: https://salsa.debian.org/gnome-team/gnome-disk-utility
Vcs-Git: https://salsa.debian.org/gnome-team/gnome-disk-utility.git
whereas
debcheckout -d gnome-disk-utility
will only show the VCS information and pertinent details (if the package is hosted in a VCS).
Checkout
If you then want to check the source out,
debcheckout gnome-disk-utility
will do that for you.
Web Interface
You can also see this information on the Debian Package Tracker, which will link to the VCS where the package is hosted (if there is one).