If you have no issues at all getting erections during masturbation, that almost always means there’s no physical prblm & the issue is most likely just so-called ‘performance anxiety’. Another sign it’s not physical is if you wake up during the night or morning with erections - that’s a good sign things are functioning normally.
I think what happens is we guys sometimes put so much pressure on ourselves to ‘perform’ (terrible word!) that we obsess over it & just the thought of ‘not getting it up’ causes the very thing we fear most, and then it becomes a vicious cycle - the more we think about it & obsess over it, the worse it gets.
Most women understand this, but nor all - after all, a female can still have sex even if she’s not particularly turned on as long as she’s adequately lubricated (using a lube or whatever), but if a guy can’t get an erection, it’s kind of a ‘no-go’ as far as intercourse goes, so there’s not much you can do other than non-intercourse sex, which is still OK & still counts as ‘sex’.
So one thing you could do is suggest non-intercourse activities like manual stimulation, mutual masturbation, pleasing each other orally, etc. Sometimes just being ‘successful’ at these other activities takes the pressure off & then things return to normal & you can resume intercourse.
If your GF is a decent person, she prbly won’t belittle you or leave you over this, which is a big fear for guys - we’re always thinking if we can’t ‘perform’ (there’s that terrible word again!), they’ll go seek out someone else. But if she truly cares about you, I think she’ll understand, especially if you show her that you’re very willing to please her manually, orally, etc.
Of course, a lot of women get concerned thinking maybe you’re not really attracted to her & that’s why you’re having the issue, so you need to reassure her that you ARE attracted to & turned on by her & that this is just an issue in your head. Open discussion about this can also help take the pressure off - she’ll prbly ask if there’s anything she can do to help...
I hope this advice is helpful - please come back & let us know if you’re able to work it out. If you can relax a bit & not obsess over it, I think you’ll be OK. At least you know you CAN get good erections & there’s nothing physically wrong...