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.
Edit: An idea I got from reading Chris Stratton's comments. If
you use a Makefile in your own workflow (this has already been discussed
in this site a few times), you could commit this credentials.h to your
repo:
#ifndef CREDENTIALS_H
#define CREDENTIALS_H
// Replace with your actual SSID and password:
#define WIFI_SSID "Your SSID here"
#define WIFI_PASSWD "WLAN AP password here"
#endif
Make a copy of this file named true-credentials.h and put the real
credentials there (but do not rename the include guard). Then add to
your Makefile
CFLAGS += -include true-credentials.h
Keep true-credentials.h and the Makefile out of the repo. You can add
them to your .gitignore or, better yet, to .git/info/exclude.
Now you have a compilable version with dummy credentials in the
repository, you have the true credentials when you compile on your own
machine, and git does not bother you about credentials.h being changed.