Then when he says, do not be therefore ashamed, he specifies the use of grace: first, he removes what is contrary to its use; second, he exhorts him to use it, at but labor with the Gospel.
Now a person may be hindered from preaching for two reasons: first, from shame; second, from the penalty the Apostle is suffering on account of the Gospel. Therefore, in regard to the first he says, do not be therefore, i.e., since you have the spirit of courage, ashamed of the testimony of our Lord. For the preaching of Christ, if it is compared with the wisdom of this world, seems folly; hence the shame ...he seems to have: we preach Christ crucified, unto the Jews indeed a stumbling-block, and unto the gentiles foolishness (1 Cor 1:23); for I am not ashamed of the Gospel (Rom 1:16); he that shall be ashamed of me and of my words, of him the Son of man shall be ashamed (Luke 9:26).
In regard to the second, it should be noted that if a robber sees anyone hanged, he is ashamed to admit that he was his companion. So, because the Apostle was in chains, Timothy may have been ashamed of him; that is why he says, nor of me his prisoner: for which I am an ambassador in a chain (Eph 6:20); reverence not your neighbor in his fall (Sir 4:27).
Then when he says, but labor with the Gospel, he exhorts him to use his grace: first, in a general way; second, he shows with what confidence he should undertake this use, at according to the power of God. Here he explains what he says next: not according to our own works, but according to his own purpose.
He says, therefore: do not be ashamed, but labor, i.e., work along with me: every man shall receive his own reward according to his labor (1 Cor 3:8). And he says, with the Gospel, which, if it is taken in the ablative case, means by preaching the Gospel; if in the dative, to the praise of the Gospel, that it may grow: the fruit of good labor is glorious (Wis 3:15).
And this with confidence not in himself, because we are not sufficient to think anything of ourselves (2 Cor 3:5), but according to the power of God, i.e., trusting in God's power: it is he that gives strength to the weary, and increases force and might to them that are not (Isa 40:29).
Source: Commentary on 2 Timothy