Template:KeepLocal/doc

Usage
will give the default request to keep the local file:

If the file is on commons under a different name, this can be accomplished with where PAGENAME ON COMMONS is the name of the page on commons with the duplicate file.