user14141430
user14141430

Reputation:

Push Project To GitHub From Android Studio Failed

I tried to push my project from android studio to GitHub but it failed. Here is the error:

Can't finish GitHub sharing process
            Successfully created project 'BurgerRating' on GitHub, but initial commit failed:
            *** Please tell me who you are.
            
            Run
            
            git config --global user.email "[email protected]"
            git config --global user.name "Your Name"
            
            to set your account's default identity.
            Omit --global to set the identity only in this repository.
            
            unable to auto-detect email address (got 'valk@DESKTOP-59LAKG3.(none)')

I don't know how to directly put a project on GitHub because it says that the project is more than 100 files. If I do it step by step, I miss some files. Please help!

Upvotes: 2

Views: 2848

Answers (3)

retriever123
retriever123

Reputation: 225

Just encountered this trying to "Share to Github" a new project on a fresh install. But once I did a Commit & Push from the normal commit menu, Android Studio opened a message box prompting for my name and email. The github integration worked fine after that.

Upvotes: 0

lechat
lechat

Reputation: 468

For me, the following worked. Please note that I'm using Windows10 and two factors verification.

  1. Get Personal access token of github by:
    Settings -> Developer settings -> Personal access tokens

  2. Save the token in .gitconfig by:

    git config --global user.name "your username"
    git config --global user.password "your github access token"

Please note that this will change the global setting that is stored in:

C:\Users\{your windows user name}\.gitconfig  

You might be better to save the backup of this file.

  1. On Android Studio, go to Settings -> Version Control -> Git and set the git executable path.
  2. On Android Studio, go to Settings -> Version Control -> GitHub and click on + or press on Alt+Insert then choose Login with token and paste the Github token that we generated in step 1.
  3. On Android Studio, from the top menu bar, go to VCS -> Import into version control -> Share project on Github and share the project.
  4. We see an error message that says project was created but initial commit was failed. Now go to VCS -> Remotes and delete the origin.
  5. Add origin with the URL https://github.com/{your github user name}/{repository name}.git which is usually used for cloning the repository.
  6. Now you can commit and push. Go to VCS -> Git -> Push

Upvotes: 0

Chass Long
Chass Long

Reputation: 539

The error you are showing is simply telling that you are not identified on your git. It suggested you resolve by the

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

you can just follow that instruction first and show what happens next

Upvotes: 2

Related Questions