Summarize this article:

Use an Ethernet cable to connect your two Mac computers to one another. If connecting a Mac to another Mac, you'll need two Ethernet to USB-C adapters to plug into your Macs' Thunderbolt 3 ports before you can connect them via Ethernet. Click the Apple logo in the top-left corner of the screen. A drop-down menu will appear. You'll find this option in the drop-down menu. Doing so opens the System Preferences window. It's in the System Preferences window. A new window will open. This option is on the left side of the window. It's in the middle of the window. A drop-down menu will appear. This option is in the drop-down menu. Doing so shares your Mac's Internet connection with the computer to which it is currently connected.
Connect the two computers with an Ethernet cable. Open the Apple menu . Click System Preferences. Click Sharing. Check the "Internet Sharing" box. Click the "Share your connection from" drop-down box. Click Wi-Fi. Check the "Ethernet" box.