Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Sending Projects to GitHub

Unable to commit to repository on GitHub

I have done this for a previous project, but GitHum commit is not working this time.

For this new project, I

  • created a new project on Android Studio (v1.5)
  • Enabled VCS Integration
  • Restart Android Studio
  • VCS --> Import into version control --> Share project on GitHub
  • Follow on-screen instructions.

Now, this creates the project on GitHub for me and I can see it there as well.

However, the initial common fails with below error

19:00:33.478: git -c core.quotepath=false commit -m "Initial commit" --

*** Please tell me who you are.

Run

git config --global user.email "you@example.com" git config --global user.name "Your Name"

to set your account's default identity. Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address

Not sure how to fix this. Can someone help?

4 Answers

Harry James
Harry James
14,780 Points

Hey Deepak!

Did you manage to get this sorted in the end? If not, I'll provide some instructions below to help you and any other students that may encounter this issue out:

1) Find the git.exe file. Go into File >> Settings >> Version Control >> Git and find the Path to Git executable. Make sure this does have a correct path, and is in fact leading to a real git.exe file, else you'll get the error Can't start Git: git.exe - Probably the path to Git executable is not valid. To check this, click the Test button.

(Don't have Git? You can download it from here)

2) Copy the path to git and open up a Command Prompt/Terminal window and type "cd path/to/git" WITHOUT GIT.EXE ON THE END. Next, type "git.exe" into the window. After that, type git config --global user.email "YOUR_PUBLIC@GIT_EMAIL.COM" (Include quotes for this command) then git config --global user.name "YOUR_PUBLIC_NAME" (Include quotes for this command).

IMPORTANT: The email and username you provide here will be PUBLIC ON GITHUB. If this isn't what you want, use the private GitHub address of YOURUSERNAME@users.noreply.github.com. Also, the user name should be your real name, not a username. For example, mine would be Harry James.

3) That's it! You should now be able to push Git commits! If you run into any problems on the way, give me a shout!


Hope it helps :)

Seth Kroger
Seth Kroger
56,413 Points

In Android Studio go to Settings and in the left panel go to Version Control -> GitHub. Enter your login credentials and try the Test button to make sure they're correct...Also make sure your local setting for git are fine. You may need to use cmd/terminal to run the suggested git command.

Sina Maleki
Sina Maleki
6,135 Points

Hi, I've done everything but they codes are no import to the github? how can I do it manually?

Seth, have tried that and Github connection is fine. Surprising thing is, that commit & push are working in another project of mine on Android Studio, even now. But this new project is just not getting committed :(

Thanks for the response Harry. Actually, this got resolved on its own. I created new projects a few times :D and restarted Android Studio. In one of the attempts, it prompted me to enter the same information on a pop-up window, which I did. And post that, it worked like a charm.

I will surely try your approach, should I get stuck again :)