Several steps need to be done if you want to upload a project,first of all,finish the project and make sure it works.
Pre-condition:
- Already get git installed in PC.
- Finish the project and it works.
- Note the path of the project,probably on top of the Android Studio interface.
Steps to upload:
- Create a repository in github,and copy the remote repository URL.
- Open git bash,change directory to the work station,use command "cd XXX".
- Better create the file "README.md",use command "touch README.md".
- Initialize the local directory as a git repository,use command "git init"
- Add the files in the new local repository,stages them for the first commit.use command "git add ."
- Commit the files you've staged in my local repository,use command "git commit -m "XXX"".
- Add the URL for the remote repository,use command "git remote add origin URL".
- Push the changes in local repository to github,use command "git push origin master".
"git add ." means add all the files in local repository.
So after first commit,if changes are made to the project and need to be pushed to github,better use Git Gui,for sure which will save a lot of work.
This is the original link,adding an existing project to github by command line.