The question really has nothing to do with your teammate, and more with a general feeling of under appreciation that you have.
Because of your insecurities (which may be legitimate) you are viewing this as a chance for failure, rather than an opportunity to show your mentoring capabilities.
How do I get credit on my work on this ticket when the team member was assigned the ticket and during meetings reports about the progress of the ticket?
Surely your manager understands you are assisting your colleague with this task.
How do I effectively work with the team member on this ticket without
the team member taking credit for my contribution?
Why don't you wait for them to actually shut you out before assuming they will take all the credit.
I think it is a bad idea to tell my manager that I don't want to pair
with the new team member on this important ticket when the ticket was
assigned to them and I am the only one of us two who worked on that
product in the past.
Your manager has assigned you this role because he thinks it's the best way forward. You are going to have to come up with a business reason, not a personal reason, which would convince your manager. Note that your manager may want to decrease the bus factor.
I feel like I'm being set up to play a supporting role when I
shouldn't be.
Obviously your manager sees you as capable of mentoring your colleague to assist their growth. You either think such a thing is beneath you, or you are not capable of assisting.
What happened is that during a meeting where we plan tasks, my manager said that he would schedule another meeting so that he would discuss that task with me and what needs to be done for it (it makes sense for me to work on this task because I worked on a closely related task about the same product). Then all of a sudden this new team member said that they wanted to be assigned that task, I objected but they were assigned that task anyway. I didn't take it because the task objectives were not in its final state so the manager wanted a further discussion about it.
The technical expression is: you snooze, you lose.
It looks like your colleague was very eager to take the task, where you were not willing because you wanted everything to be specified before taking it.
I have spent time as a team leader, responsible for delegating tasks, and what I can say, there are a range of factors at play. Sometimes it's not totally scientific. Sometimes it can lead to team members working on things that they wouldn't otherwise work on. And sometimes you do assign tasks because someone is interested in exploring an area. If someone is new to the team, you certainly want to encourage their interest, rather than lose that initial "starter spark" that new team members have.
If I had an experienced team member, and they showed reluctance to act as a mentor, that is something that I would have to sit down with them to discuss, due to how important mentor-ship is in my field. That may lead me to even pigeon-hole them, depending if I viewed their conduct as particularly childish or petty.
How am I supposed to not do the work for them and not come across as
selfish when my manager is pairing me with them to work on the same
task?
Nobody is saying you should do the work for them. You are to mentor them through the task. No doubt some of your time will be spent writing code.
Should I suggest we work on different git branches?
If that is a technical solution that will allow you both to work more effectively, you should do that.