Allocating cash deposited by me, to invoices

You can’t do both without creating duplicate entries, so only do one. What you need to do is allocate those deposits that represent customer payments to Accounts receivable => Customer => Invoice #. The Guide below is about doing so automatically with bank rules, but the procedure for doing it manually should be obvious after you have read it.

On the other hand, if you’ve already entered the deposits separately, just delete the bank transactions they duplicate.