Dear @Zee Zita,
Thank you for reaching out to the community and for sharing your question with us!
If you've already been accepted for a study program in Germany, you can probably have a look at the university's website and find information about getting a visa as well - or even reach out to the student service via Email.
Nonetheless, I've had a look and found a few sources regarding student visa applications.
Here is some general information about German Student Visas by "Studying in Germany": https://www.studying-in-germany.org/german-student-visa/#visa-requirements
And some information on getting a student residence permit: https://www.studying-in-germany.org/german-student-visa/#how-to-get-your-student-residence-permit-in-germany
As another source writes:
"Germany offers a few different types of student visas, all available by applying through the German embassy or consulate in your home country. Make sure to do this before coming to Germany.
- The Schengen visa allows people to stay in Germany for up to three months per half-yearly period. These visas are ideal for those who are interested in touring around the country or taking short language courses.
- Language course visas cover students' stays for the length of the language course.
- National visas allow students to stay longer than three months and are designed for those who want to pursue academic degrees or more extensive educational research.
- Student applicant visas are for students who want to study in Germany on a longer-term basis but have not yet been admitted to a university. This visa allows them to come to Germany for three months to look for a program. Once they have enrolled, the visa can be converted to a national visa. If they do not enroll in a program within three months, the visas may sometimes be extended but that is up to the discretion of the visa-granting authorities."
There are several kinds of visas in Germany that you can get as a student - and some people have to apply for a visa before entering Germany (meaning - you might have to leave Germany before you can use the student visa).
The Auswärtiges Amt (Federal Foreign Office) also writes that you need to apply for a student visa before entering Germany here: https://www.auswaertiges-amt.de/en/aamt/zugastimaa/buergerservice/faq/-/606848
However, it's worth it to contact the university you'll be studying with (if you already applied somewhere/ got accepted) or the German "Auswärtiges Amt" (Federal Foreign Office), there may be other options.
I hope this helps. Let us know if you need any further assistance!