Why is the command not found when adding an apt repository?

The error add-apt-repository: command not found
usually appears when the add-apt-repository
command is not available on your Linux system (typically Ubuntu or Debian-based distros). This command is provided by the software-properties-common
package.
Solution
Run the following command to install it:
sudo apt update
sudo apt install software-properties-common
After that, you can try running:
sudo add-apt-repository <repository>
Example:
sudo add-apt-repository ppa:deadsnakes/ppa
If you’re using a different distro (like minimal Debian or WSL), this feature might not be included by default.
If the error persists, let me know your distro/version (lsb_release -a
) and I’ll help you further.