So I am having trouble getting the mirrors on my machine aligned.

So I am having trouble getting the mirrors on my machine aligned. I can get them aligned close up but as the machine travels down the rail it goes out of alignment and ideas

check if your rays are parralell to X and Y, then center into last mirror.

@StephaneBUISSON not quite sure what you mean

I mean, if you try to correct a deviation , in fact you make it worst. being parrallel to axes, you will be right.
before trying to align, look into tube position parallel to X (look the wrapping foam if any, the holder being to large for the tube), look as well if the head is well vertical (bent ?).
then align the mirrors. several links into community to help you.

I was having trouble adjusting the beam with just the mirrors and then realized that the laser tube itself was not parallel to the gantry.

Also check the XY gantrys. I need were not initially square.

My tube seems to be straight but I do notice my X Y gantrys are not square could that be the issue and if so how do I fix it is there a good YouTube video

@Jim_Hatch how do you square them

The X gantry on my latest machine was out of whack, I loosened off the belt tensioner on the offending side and skipped the belt a few teeth so it was level.

Note, I had to unbolt the whole gantry first to gain access to the belt tensioner.

I always reference this video for mirror alignment https://youtu.be/KhhOHUe_b6o see 11:37 minutes for the principles. Hope this helps.