It is never easy to insult someone unintentionally, unless you are in a strange country with a very different culture. If both of you are working at the same place, on the same project, I'm quite sure that both of you also speak the same language. This means, both of you are likely acculturated to the same beat. Note, I did say likely.
On a personal level, you can think before speaking.
When you realize that you've made a mistake (we all make them), make every attempt to make reparation. The words "I was wrong" go a long way in having an apology accepted. This is because the person you offended likely thinks that you are unreasonable, so .. well .. make every attempt to convince them that you are reasonable :)
Sometimes this has to be a passive process, it depends on the other person. You might consider asking them for advice on something, including them in some activity, or otherwise saying "It wasn't personal".
If I meet you and start conversing with you, I'm placing an implicit trust in you that you won't do something bad to me. Just do your best to demonstrate the fact that you are a good natured person, who is flawed just like everyone else.
Or, you could just control your temper :)