@Abc123 Right, so you've got the Giant SyncDrive motor side with red, green, and blue, and the speed sensor side with red, green, and black. You've already done the sensible thing with a multimeter, which puts you ahead of most people who'd just start guessing and frying things.
On the Giant SyncDrive systems, the speed sensor is a simple hall effect type with three wires: power, ground, and signal. Based on what you've measured, if green is ground (earth) and blue is +5V on the motor side, then the remaining red on the motor side is your signal line.
On the sensor side with red, green, and black: green should match to green (ground), which you've confirmed. That leaves you needing to work out which of red or black on the sensor is +5V power and which is signal. Typically on these sensors, black is ground and red is +5V, but since your green is already confirmed as ground, the convention gets a bit muddled with this connector. I'd suggest using your multimeter to check continuity on the sensor itself: the +5V supply pin on the sensor should show no continuity to ground, while the signal wire will typically show high impedance to both power and ground when the sensor isn't triggered.
So the likely mapping is:
| Motor Side | Function | Sensor Side |
|---|
| Green | Ground | Green |
| Blue | +5V Supply | Red |
| Red | Signal | Black |
That said, I'd strongly recommend verifying before you commit to soldering or crimping. With the sensor disconnected, put your multimeter across the sensor's red and green wires and check for a low resistance path (which would confirm red is power, not signal). The signal line on a hall sensor will behave differently, it won't show a simple resistance to ground.
One other thing worth mentioning: the speed sensor on these Giant systems is a known weak point. Community members have traced cutting out issues and error codes specifically to the sensor or its connector failing. The part number for the replacement sensor cable is SR SD071.02 if you need a fresh plug to crimp onto. Alternatively, a reed switch off AliExpress for a couple of quid works as a budget replacement if you just need the bike running again.