I'm not an expert in this field, but this seemed interesting enough I did some reading up on the topic. The two review papers I found quickly were Prasse & Kikano (2008) and Lawrence & Barclay (1998), both from the Journal of the American Academy of Family Physicians. I have no idea whether this is a reputable journal or not.
There appear to be three types of stuttering; developmental (acquired during youth, often leaves after age 4), neurogenic (acquired due to neurological trauma), and psychogenic (secondary symptom of latent psychiatric disorder) . Interestingly, the articles disagree on whether psychogenic still exists (see Etiology discussion in ). While both articles suggested that the etiology of stuttering is largely unknown (see here, Etiology section), theories suggest that there's a neurologic dysfunction at play and/or physical causes relating to airflow. Specifically, the neurologic dysfunction suggests increased brain activity during speech in stutterers relative to non-stutterers. There's a lot of discussion about genetics and stuttering as well; read the articles for more.
Your situation as described seems to be in the "developmental" case, with a neurologic underpinning. Assuming no car crash or other blunt force trauma in your past, your stuttering comes and goes depending on the situation (i.e., if you're in public or private). As such, the symptoms you describe are likely related to stress, discussed in both articles above. It seems to be understood that stuttering as a disorder can be overcome with time and practice, and it seems that you have managed to do that to a small amount. However, stress is a large factor in stuttering, and can in fact exacerbate the problem tremendously. For what it's worth, I can also state anecdotally that stress is a large factor in stuttering, and for some people the severity of the stutter will increase as a factor of how stressful the situation may be.
I'm not sure that this addresses the singing aspect of your question. Hopefully someone else can address that.