Skip to main content
1 of 2
Edgar Bonet
  • 45.2k
  • 4
  • 42
  • 81

You could commit the following file into your project, named credentials.h:

// Replace with your actual SSID and password:

#define WIFI_SSID "Your SSID here"
#define WIFI_PASSWD "WLAN AP password here"

Near the beginning of your sketch, you add:

#include "credentials.h"

const char ssid[] = WIFI_SSID;
const char password[] = WIFI_PASSWD;

Now, you can edit credentials.h to add your real SSID and password, and go on with your normal git workflow, with one exception: never git add credentials.h again, nor git commit -a.

Now, git will always remind you that credentials.h has been modified and is not staged for commit. It will do so even if you add the file to your .gitignore. If you always review your changes before committing, this is only a minor inconvenience. If, on the other hand, you tend to git commit -a without reviewing what you are committing, then this solution is likely not for you.

Edgar Bonet
  • 45.2k
  • 4
  • 42
  • 81