My Git and GitHub

Create a repository in the Github, for example, my Github resources are at https://github.com/atikrkhan/ and I create a repository as follows:

https://github.com/atikrkhan/SentimentAnalysisFromTwitteR.git

Clone the repository (commands to write in the Git Bash)

$ cd d:  
$ mkdir MyGitFolder

Now, enter the folder MyGitFolder created above and clone the repository. This will show SentimentAnalysisFromTwitteR in MyGitFolder directory. We see that the SentimentAnalysisFromTwitteR has been created.

$ cd MyGitFolder
$ git clone https://github.com/atikrkhan/SentimentAnalysisFromTwitteR.git 
$ ls

Do configuration if necessary, generally done automatically!- if not do as follows

$ cd MyGitFolder
$ ls
$ cd SentimentAnalysisFromTwitteR
$ git config --global user.email user@yxx.com
$ git config --global user.name myname

Do staging (use git add * for all files, git add filename.txt for the file filename.txt, git add –all or git add –A for folders) and check status. Status will be changed (generally from ?? to A, displayed at the left of file name) to show it has been staged.

$ ls
$ git add *
$ git status -s

Check version in the server site and commit

$ git diff    
$ git commit -m "Initial commit"

# Push to the server site

$ git diff
$ git push origin master

If prompted for username and password, provide those information.

Check the repository from the browser

https://github.com/atikrkhan/SentimentAnalysisFromTwitteR.git

Here is an alternative way to do the above mentioned tasks by creating a folder first, then initializing the repository, and adding to the origin:

$ cd d:
$ mkdir TwitterMining
$ ls
$ cd TwitterMining
$ git init    
$ git remote add origin https://github.com/atikrkhan/SentimentAnalysisFromTwitteR.git

Now go back to the directory, do staging and commit

$ cd ..
$ cd TwitterMining
$ ls     
$ git add *     
$ ls
$ git status -s   
$ git diff    
$ git commit -m "Initial commit"

If commit fails, do configuration as described above. If passed, then push to the server.

$ git diff
$ git push origin master

Check the repository from the browser

https://github.com/atikrkhan/SentimentAnalysisFromTwitteR.git

 

If you want to clone from the server to another folder

$ cd ..
$ git clone https://github.com/atikrkhan/SentimentAnalysisFromTwitteR.git TwitterData
$ ls
$ cd TwitterData
$ls

This will show cloned files in the TwitterData folder.