Since this year everyone with a residential permission has the right to open some kind of basic account in Germany. Fees differ from credit institute to credit institute and the basic
account does not include the right to receive a credit card.
To receive a credit card most financial institutes check if you have any shufa entries in relation to debts.
Moreover they expect you to prove that you receive a regular income.
If you fulfil both requirements it should be no problem for you to obtain a credit card.
If you do not receive a regular income, another possibility for you would be to obtain a prepaid credit card.
This kind of credit card can be handled like a regular Master Card except that you can only pay if you always have a positive balance, which means that you have to put Money on your credit card account in advance. But fees for some of these cards are relatively high.
In short, either you can get a regular credit card if you prove regular income from a job or you should google for prepaid credit card.
I hope this helps.