git clone

 

https://help.github.com/articles/cloning-a-repository/

anne@Inspiron-15R:~$ git clone https://github.com/udacity/ud839_Miwok.git
Cloning into 'ud839_Miwok'...
remote: Counting objects: 809, done.
remote: Total 809 (delta 0), reused 0 (delta 0), pack-reused 809
Receiving objects: 100% (809/809), 2.26 MiB | 1.90 MiB/s, done.
Resolving deltas: 100% (248/248), done.
anne@Inspiron-15R:~$

How to add an Android Studio project to GitHub

https://stackoverflow.com/questions/37093723/how-to-add-an-android-studio-project-to-github

This below is from the above:

  1. Sign up and create a GitHub account in www.github.com.
  2. Download git from https://git-scm.com/downloads and install it in your system.
  3. Open the project in android studio and go to File -> Settings -> Version Control -> Git.
  4. Click on test button to test “path to Git executables”. If successful message is shown everything is ok, else navigate to git.exe from where you installed git and test again.
  5. Go to File -> Settings -> Version Control -> GitHub. Enter your email and password used to create GitHub account and click on OK button.
  6. Then go to VCS -> Import into Version Control -> Share Project on GitHub. Enter Repository name, Description and click Share button.
  7. In the next window check all files inorder to add files for initial commit and click OK.
  8. Now the project will be uploaded to the GitHub repository and when uploading is finished we will get a message in android studio showing “Successfully shared project on GitHub”. Click on the link provided in that message to go to GitHub repository.

My extra notes:

When you’ve made a change to a file, select the file or directory in the Project window, select main menu VCS -> Commit… -> Commit and Push. Notice after you’ve created a project for a repository in GitHub (via Android Studio as described in the 8 steps above) any changes to a file changes the colour of the file name to remind you to commit and push it to the repository.

https://stackoverflow.com/questions/37093723/how-to-add-an-android-studio-project-to-github

This below is from the above link at the very bottom of the page:

The most important thing we forgot here is ignoring file. Every time we run gradle or build it creates new files which are changeable from build to build and pc to pc.We do not want all the files from Android Studio to be added to Git. Files like generated code, binary files (executables) should not be added to Git (version control).So please use .gitignore file while uploading projects to github. It also reduces the size of project uploaded to server.

  1. Go to root folder.
  2. git init
  3. git add .
  4. Create .gitignore txt file in root folder. Place these content in file.*.iml
    .gradle
    /local.properties
    /.idea/workspace.xml
    /.idea/libraries
    .idea
    .DS_Store
    /build
    /captures
    .externalNativeBuild
  5. git remote add origin https://github.com/username/project.git
  6. git commit - m "My First Commit"
  7. git push origin

Note : As per suggestion from different developers, they always suggest to use git from command line. It is upto you, how you prefer it most.

Crash course on Git and GitHub

I followed the instructions in the movie above to store the source code file from my IntelliJ project (click here to see the project) in a repository in GitHub.com

These are my terminal commands to commit my IntelliJ source code files to a new repository in github .com:

cd /home/anne/Desktop/ud282-master/GameApplication/src/com/company
ls
clear
pwd
ls
git init
git config --global user.name 'annedawson'
git config --global user.email 'anne.dawson@gmail.com'
git status
git add *.*
git status
git commit -m 'Updated Thu Jan 18 9:53'
git status
# Login to github.com
# Create new repository at GitHub.com
# the following are from GitHub.com
echo "# ud282-GameApplication" >> README.md
git add README.md
git status
git commit -m "first commit"
git remote add origin https://github.com/annedawson/ud282-GameApplication.git
git push -u origin master
# update /home/anne/Desktop/ud282-master/GameApplication/src/com/company/Main.java
git status
git add Main.java
git status
git commit -m "updated Main.java Thu 18 Jan 11:15"
git push

https://github.com/annedawson/ud282-GameApplication