Solution for unconnected GPIO extender pin
Let's analyse your two circuits.



Figure 1. Not good.


When GearN is connected to GND then MCP-A0 will be 4.7 V above GND as determined by R1 and D1. So far so good.
When not in neutral GearN will be open circuit so MCP-A0 will be pulled to +12 V by R1. Not good. The GPIO may not survive.




Figure 2. A bit better.


When GearN is grounded then MCP-A0 will be grounded.
When GearN is allowed to float MCP-A0 will be pulled towards +12 V by R1 but will be clamped at 4.7 V by D1. This should be adequate to provide a high to 5 V logic.








simulate this circuit &ndash; Schematic created using CircuitLab

Figure 3. Pulling up to the microcontroller's supply.

Using the microcontroller's supply is better as there is no risk of over-voltage on the input. Adding a capacitor to any of the circuits will help filter out any noise on the wiring. If the micro has internal pull-ups then you can omit R1.


  I'm trying to make my own motorcycle gauge. I want to read 12V digital signals. 


If you have disconnected the original lamps then you are only checking for continuity to chassis / ground. (That's why I asked.)


  I'm using Zeber [Zener] diode as a voltage regulator (on motorcycle this 12V fluctuates a lot) to get reliable 4.7V so the MCP27013 can safely read the state.








simulate this circuit

Figure 4. Opto-isolation.

You might consider opto-isolating your inputs. This solves any problems with spikes on the 12 V bus.