When I opened xcode and tried to make a macosx app, this weird message came up.
Is this a glitch or a virus, as Apple wouldn't say something like this. It does not look like a system message.
No, this isn't a virus1.
It seems that your name and email address are not set up properly in Git. Go to Xcode Preferences and then Accounts, select the repository, and check the username.
You can also do this via the command line:
git config --global user.email "firstname.lastname@example.org" git config --global user.name "Your Name"
1: The message content can be found in /Library/Developer/CommandLineTools/usr/libexec/git-core/git (git version 2.7.4 (Apple Git-66) lines 11416-11424).
Although the correct answer has been given above, that the message is by no means a virus, a more general explanation is due:
Xcode is a git client. It maintains git repositories for its projects, is able to create and manage them, and provides nice UI for many day-to-day git tasks.
Usually, when you setup Xcode, you create one or more "accounts" within Xcode, used to identify you against the App-Store and other entities, so that Xcode can save you lots of tedious mucking about setting up trusts, certificates, etc. when developing for iOS and Mac.
When you do that --- Xcode will also auto-config git for you, automatically creating the .gitconfig file, with Name, e-mail and the rest.
However, if you refrain from creating an initial account, and create a Mac project right away - your git setup is incomplete, and git itself will produce the dialog depicted in the question.
You can either simply configure .git as usual, providing it the basic info it needs, OR go back and add an Xcode account (in Xcode preferences) and let Xcode complete the git settings for you.