# ssh-copy-id takes care of adding your key in the right place
ssh-copy-id -i "firstname.lastname@example.org -p2222"
# If you don't use -i all of your public keys will be copied over.
# Also a alias for the host can be used if configured in your ssh config.
# You will be asked for the password and after that all should be taken care of.
# There are a few ways to change the url in wordpress
# The prefered method is the wp-cli via search-replace.
$ wp search-replace 'http://example.test' 'http://example.com' --skip-columns=guid
# You can also test with a dry run
$ wp search-replace 'foo' 'bar' wp_posts wp_postmeta wp_terms --dry-run
# If the wp-cli is not available or you can't use SSH there are three other ways to try inside the files wp-config and functions.php
# At the beginning of wp-config.php, add
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
# At the end of the file, before the comment to stop editing here, you can set the relocate method. This always takes the current url calling "/wp-login.php" as slug as site url.
# Inside funcions.php, as first call, you can set
update_option( 'siteurl', 'http://example.com');
update_option( 'home', 'http://example.com');
# Use Plugin
The plugin 'Better search replace' is also able to change the links in the database quite easily.
# As last resort, you can change the database values manually.You will have to look for "siteurl" in the table "wp_options" and change the values to the correct url.
# After changing the url, don't forget to remove the above settings again. Move to your settings in the backend and check the url. Also, inside the options section, look for "permalinks". It will bring you to an options page where you can regenerate the dynamic links. Without this regenerating, links for assets, media files and so an would possibly keep pointing to the old url.