Kind of; they were all cities after all, weren't they? In times of war, a landward attack was certainly possible, if improbable. You'll notice that the geography of the cities predisposes them to navigation: Genoa and Amalfi are pressed up against the sea by mountain chains (or rather, towns on the Amalfitan coast are nestled between steep hills, to a similar effect as the the Ligurian Appenines) while Venice was in the middle of a lagoon, as was Pisa; at the mouth of the Arno (the land around Pisa has long since been interred, while Venice's lagoon still exists and is indeed world-famous).
Venice, the maritime republic which I am most familiar with, was never invaded or even vulnerable to invasion until artillery became sufficiently developed in the 18th century (I wrote an answer about early venetian politics and dispute resolution here). Indeed, Venice held out against a number of invasion efforts in the very earliest middle ages; on the other hand the early modern period the Republic's mainland territories were absolutely vulnerable and an oft-trodden battleground of the Italian Wars, while the city itself remained safe.
The Republic of Genoa, as far as I know, was from the fourteenth century on more predisposed towards entering a clientelistic relationship with greater powers, however this was more of a consequence to the arrival of powerful ruling dynasties in nearby Lombardy (the Veneto, on the other hand, remained more fragmented unstable and was eventually absorbed by the Venetian Republic). Amalfi too decided to intentionally aggregate itself to the Kingdom of Sicily once the political situation in Southern Italy stabilized in the eleventh century. Pisa, which has a fiercer history of independence, ended up unwillingly developing a similar if more contentious relationship with medicean Tuscany.
In the end, the traditional Maritime Republics were four Italian cities which entered the popular imagination because of their seafaring traditions. There were many such cities in medieval Italy (Ancona, Lucca, and even Comacchio are cities and towns with colorful maritime histories that come to mind) and countless more urbanocentric polities in Italy between the eight and twelfth-fourteenth centuries. Small and disunited, almost all were vulnerable to both stronger foreign powers, as well as each other.
If you're interested in a more specific aspect of conflict resolution in medieval Italy feel free to ask follow-ups!