Option 1 - Follow the instructions
Search for any instructions on how to install the add-on in the first place and make sure you follow them step by step (can vary). In most cases those instructions listed in the README.md as part of the repository.
Option 2 - Release version
Before downloading the entire repository using the 'Code' button, make sure there is no actual release (In most cases there is, to keep development organized):

If so, click on Releases Tab and download the latest release (.zip or single .py file):

Once downloaded, go to Edit > Preferences > Add-ons > Install, select the file (zip or py file) and press Install Add-on as usual.

Option 3 - No release version but __init.py__ located in the main directory
If there is no release version, using the 'Code' button is the only option to download the add-on. If there is an __init__.py file located in the main directory, click the green 'Code' button and download the zip:

Once downloaded, go to Edit > Preferences > Add-ons > Install, select the file (.zip or .py file) and press Install Add-on as usual.

Note: This way you can also try an experimental version of the add-on in case the release version is behind some changes.
Option 4 - __init__.py is part of a subfolder
Search for __init__.py in the repository and copy the folder containing this file to your Add-on directory:
- Linux:
$HOME/.config/blender/<version>/
- OSX:
/Library/Application Support/Blender/<version>/
- Windows:
%USERPROFILE%\AppData\Roaming\Blender Foundation\Blender\<version>\
You can get also get the folder per machine using the python console: bpy.utils.script_path_user() and / or bpy.utils.script_paths("addons")
Further reading: Addons: Only some .zips will install