Android Studio and sharing project to Github
This assumes you already have Git installed on your computer
STEP 1: SETUP local git
Setup your Project in Android Studio with git locally by going to VCS->Enable Version Control Integration and choosing git
STEP 2: Add your login details to github ONLY ONCE to the Android Studio IDE (only do once not each time for a project)
STEP 2.1 Create Token for Access to your Github Account
You are going to create a credential to use your Github account and access via a token (<<< Follow the Github directions on how to do this. Go to Profile picture right click to Settings. Select Developer Setting. Select Personal Access Tokens and Tokens (classic, not the beta) and Generate New Token (again classic token)and MAKE SURE you select repo and all the options available. If you make your token without an expiration you really only have to do this once). BE VERY CAREFUL TO SAVE YOUR TOKEN (you can not view it again) ---> Save it somewhere secure . NOTE: if you have previously created a token and you saved it somewhere you should be able to reuse it and can jump to step 2.2
STEP 2.2: Next you will go back to Android as shown below AND Go to File->Settings and in the Settings dialog window go to Github and hit + to add new credentials of your account.
STEP 3: For each new Project you need to once setup to initially Share to Github on a new repository
SPECIAL NOTE: in the past version of Android Studio and GitHub was able to do (Git->Github->Share Project) however it is not able to connect with the token use we setup in STEP 1 at this time. The token must use the https protocol for connecting not ssh.
So instead you need to
STEP 3.1) GO to GitHub.com and create a new repository(simply log into github and hit and copy the https .git connection URL on Github which is the same URL as the repository when viewing in a web browser with .git added at the end. You can also grab it from the main interface where it says:
STEP 3.2: IN Android Studio manually add theremote by going inside Android Studio to Git->Manage Remotes, hit + and add a name and the URL from STEP 3.1
STEP 4: Now Commit and Push files as you develop and test code
NOW when you commit and push files it will add it to both the local git repository AND the remote GitHub repository
IF you have any errors pushing to GitHub you can try the comand line....replace the URL https://github.com/YOUR_ACCOUNT/YourRemoteRepository.git with the URL to YOUR remote GitHub repository
git remote add origin https://github.com/YOUR_ACCOUNT/YourRemoteRepository.git
git branch -M main
git push -u origin main