You are not liable for debts that are not in your name. However if you have had a joint liability, a financial link can be created with that person on your credit history as an 'associated person' which may indirectly impact on your own ability to obtain credit. Unfortunately you are not entitled to an associated person credit history so it can be tricky extricating ones self from the history another has created.
What is relevant is whose name is on the agreement, as this is the person who will be legally liable for the debt. Therefore, a husband is not responsible for his wife's debts, or vice versa, if his name is not on the original credit agreement. If a debt is in joint names, you have what is known as 'joint and several liability'. If you are financially linked to another person, then lenders are allowed to take both your credit histories into account when either of you apply for credit, because they see you as one financial unit and the credit of one would impact on the other. The credit history of anyone you're linked to is not shown on your credit report, but their name will be listed as an 'associate'