Upload files in GitHub using Git Bash Terminal (Creating Basic Repository and Adding Files)
As we all know, GitHub is a wonderful platform where you can share, discover and build various software. So in this blog, I will be discussing in detail about creating a basic repository and adding files in the repository.
Pre-requisitions before using Git Bash Terminal
Before you use Git Bash, make sure you have your GitHub account so that you can create your repository there then upload and view your files. In case you do not have an account, you can follow the link to know the detailed procedure for creating a GitHub account as below.
If you have a GitHub account, you are required to install Git in your PC in order to implement all the steps ahead. So, if it is not downloaded and installed in your PC yet, visit the link below to get it installed with proper guidance.
Procedure for uploading files in GitHub using Git Bash Terminal
Step 1: To create a new repository, first, go to the top right of the menu bar in your GitHub account. Here, you must see a “+” sign. You can now click on it and select the first option of drop-down list i.e. “New repository”
Step 2: Now, you should give a name for the repository, for now I have named the repository as sample_template. Then, select “Public” option if you want to allow everyone to view what you have uploaded in repository whereas you need to select “Private” option if you want to choose the individuals who are allowed to view this repository. Then, check “Initialize this repository with a README” in case if you want to immediately clone the repository to your PC. Then, click on “Create repository” button.
Step 3: If you are redirected to page as shown in the image below then, your repository has been created successfully.
Step 4: Now, open the file which you want to upload in GitHub.
Step 5: Right click on file explorer in which the files that are to be uploaded opened, then click on “Git Bash Here” as shown in image below.
Step 6: ‘cd’ command is used in order to go to certain files. Since, we have already reached the destination which comprises of all the files that are to be uploaded in GitHub, we will not be executing the cd command.
Step 7: ‘ls’ command is used in order to view the files that are present in that directory. The purpose of ls command can be clear after viewing it’s implementation which has been shown in the image below.
Step 8: Enter command as ‘’git init”, in order to initialize an empty git repository. So, what this basically does it that it prepares your directory to be uploaded.
Step 9: Now, go to your repository and copy the HTTPS link which has been shown in the image below. Then, go back to Git Bash.
Step 10: Provide command as “git remote add origin “ then paste the HTTPS link of your repository. git remote add origin is used to add a new remote.
Step 11: Enter command as “git remote -v” to check if fetching and pushing is working or not.
Step 12: Give command as “git add .” to take all files from your directory and push it to your repository.
Step 13: Provide command as “git commit -m “First commit” ” to make the first commit in the GitHub repository.
Step 14: Finally, enter command as “git push origin master” to push the master directory to the origin.
Step 15: Now, go to your GitHub repository and refresh the link. In the repository, you can now see that all the files have been uploaded.
If you want a sample template of the website to practice the tasks, then the link has been attached below.
Contribute to hrishavtandukar/sample_template development by creating an account on GitHub.
Also, in order to view the contents regarding various services of AWS you can visit the link provided below: