Hello, I'm Keith and happy to help you with your question.
Do have a look at HMRC guidance notes CG64555. There you will see that if you are required to reside in job related accommodation by your employer, own a house and intend to resume normal residence there in due course, your Private Residence Relief (PRR) extends to cover the period of occupation of job related accommodation. There should be no Capital Gains Tax (CGT) liability if you sell your own residence.
This exemption does not apply if you are a Director of any company which provides such accommodation. However there are exemptions even to this caveat as you will see as you read the notice.
I do hope I have put your mind at rest on this little problem. I could expand further into CGT, but think that there is no need in this case following the tenor of your query. If you do need more information please do not hesitate to follow up my response.