Well to start with you don't really need to get rid of them. Ants are not plant eaters. They might eat the melon if one got broken open, but they won't harm it until then. They are partly detritovores, eating dead insects and dead, decaying plant tissues. They are generally not harmful in the garden.
Otherwise they do like sweets, including the honeydew secreted by aphids. So the worst thing that ants do in a garden, is sometimes "farm" aphids for the honeydew.
If you really want to get rid of them, type ant control in the Search the Forum keyword box and find tons of stuff written here already about it.
Here's one big discussion we recently had: