Yes, you can train a German shepherd not to bark. German shepherds will learn when to bark and when not to bark through proper training.
Teaching your German shepherd the “speak” command is a great way to reduce barking.
If your dog is barking, distract him from barking and then say “speak.” When your dog barks after hearing the word “speak,” give your dog a treat. Through repetition, your German shepherd will know when it is okay to bark.
Please remember, training your German shepherd requires patience, consistency, a firm tone, and a loving attitude. Stay away from anti-bark collars and muzzles because they will exacerbate any behavioral issues your German shepherd has.