Note: Before starting this, let’s assume initial setup of Git and GitHub is already done.

First create a directory on your local machine. Open a terminal (Mac) or GitBash (Windows) and change the directory to created directory. Here “Test” is the directory created on Desktop.

In order to be able to communicate with the Central Repository created in GitHub, Initializing the created directory as Local Repository would be required. Git init is a one-time command to use during the initial setup of a new repo.

Command : git init

Next clone the Central Repository from GitHub to Local using one of the methods “HTTPS” or “SSH”. Here method used is HTTPS. Copy the HTTP/S URL to clone it to local.

Use the git clone command with copied URL from GitHub. Once cloned the central repository to local , the repository would appear in the local directory. Here created repository in GitHub is “DevOpsDiggers”.

command : git clone <Copied URL from GitHub>

“git status” command also would help to validate the cloning process and it says on which branch user is on.

Command : git status

Change the directory to the cloned repository.

Created the new file in Local Repository with the name of “FirstFile” . Before adding the file if the status is checked, the file name would show-up in red color.

Add the file using the git add command and check the status. The file would be seen in green color.

Command : git add <filename>

Then commit the added file using git commit command along with commit message. This commit message would help others to understand what has been committed to the GitHub Central Repository.

Command : git commit -m “commit message”

Right after committing the file if checked for the status, file would not show up but displays the message “nothing to commit, working tree clean” and the branch is ahead by some commits. This means, the pushing of file to GitHub Central repository is yet to be done.

Final step is to push the file using the git push command.

command : git push

Pushing first file to GitHub repository is done and the file can be seen in GitHub repository.

Devops Diggers

Share
Published by
Devops Diggers

Recent Posts

Where Is The Mobile Cloud? Everything You Need To Know

Storage systems have evolved as the need for them has increased. Nowadays, in the digital…

5 days ago

WI-FI: What It Is, Concepts And How This Technology Works

Wi-Fi has become an essential part of everyday life, as it is used for wireless…

2 months ago

Trends And News 2024 In The World Of Mobile Phones

The World of mobile phones constantly evolves, offering innovations and trends that transform the industry.…

3 months ago

Here Are The Computer Basics Everyone Should Know

In the field of computing, there are a series of basic concepts that you need…

4 months ago

Discover How to Optimize WordPress and Accelerate its Speed

How to improve WordPress speed? This content management system excels at achieving optimal loading times,…

5 months ago

Technology Systems Integration 2024: Key Trends and Advances

Systems Integration by 2024 With the increasing complexity of technological systems, integration has become a…

6 months ago