Saturday, June 26, 2021

How to add files in GitHub?

 This is further to my previous post. Now, you have created a repository in GitHub, but the question is how would you associate your online repository to your laptop and add files. 

We can definitely do this over the browser by uploading files, but let us see how do we do it by using command line. 


We will use the following git commands.

Step 1: We need to first install GitHub in your machine from the below url

https://git-scm.com/downloads

Step 2: Use command promt or Terminal and go to the folder where you want the repository. use the below command to clone the repository.



Before that copy the https url from github, refer to the image to find where you will get the url of your repository. 


git clone https://github.com/apartha77/PSD-AWS-CNF.git


If this first time then you will not have any file, but in the following steps we will add files from your machine. 





Step 3: Now first we will do a git pull, although we know there is no file in our repository to be downloaded locally. But wanted to cover the command here.


git pull


Step 4: Now chek status of our repository


git status 



Step 5: Now that we have created few files which we want to push/upload to github. We can use add . and then commit or we can put both in one command. We can add comments of what we are committing in this push. 


git add .


git commit -a -m "first add"


Step 6: Now chek status of our repository


git status


Step 7: You can check the files over the browser reflecting in your repository. 


If you have queries, do drop in your queries below.

...HaPpY CoDiNg
Partha 


Thursday, June 24, 2021

First Repository in GitHub - Getting Started

First Repository in GitHub - Getting Started

When I started with Git & GitHub, I faced few minor challenges. Hence, thought to create a small write up to help people like me :).

Go to https://github.com and create your account

Once you have logged in, click on the + sign to create your 1st repository. 


Give a name to your reporistory and remember to select the README File. This will allow you to write something about the repository, purspose etc. 


Now, you are good to start - creating or uploading your files, documents whatever you want manage on GitHub. 

In the next blog, I will show you how you can install GitHub in your laptop and manage files - pull, push, commit etc.



If you have queries, do drop in your queries below.
...HaPpY CoDiNg
Partha