Remove YUM repos from Red Hat

One might accidentally add a repository in “yum” that breaks yum with problems like:

Cannot retrieve repository metadata (repomd.xml) for repository: foo.

where “foo” is the name of the repository causing problems. Check to see if the repo RPM package is listed by

rpm -qa | grep -i foo

Which will respond with the name of the matching RPMs–if one of them matches the undesired repo:

rpm -e foo