How to Connect Git to Github Repository

.

 GIT and Git Hub Configuration

Your first time with Git and GitHub


How to Connect Git to GitHub



Steps 1: GIT Configuration

  • Installed and configured git

How to Check Whether GIT is installed properly or not?

git version
git version command is used to know the version of git and also to verify whether the git is installed properly or not.

Verify whether git is installed or not


Once git is installed successfully the next step will be as follows.

Create a Folder in your local Machine. (you can use your existing folder also)



Open the folder and add all the files you want to push on Git Hub.



Now Right click on your mouse and select the option open git bash here.


 Now Run the command git init 



Now Run a Command git add. (to add all files on staging area)


Now Run a git Command git commit -m "message"



Wow!!! You have successfully set the git in your local machine...

Step 2: GitHub Configuration
  • Create a GitHub Profile. (if you already have a git account skip this step)
  • Create Repository (Repo)

Step 3: Connect Git Repository to GitHub Repository

How to Connect Git to Github?

To connect your git to Github Repo just follow the below Steps.

Make sure that you have installed Git and also created a GitHub repo.

Step 1 Create a GitHub token (Generate a Personal Access Token on GitHub).

To generate a Personal Access Token on GitHub follow the below Steps

Click on your GitHub profile




Now Click on Settings Option 



Scroll Down page and click on the developer setting Option.



Now Click on the personal access token ->Token (Classic) Option.


Now Click on the Generate new token option then select the Generate new token (classic) option.



Now enter your Git hub password.





Enter Note (enter accordingly)
Select Expiration accordingly (select accordingly)
Select Scopes (All Check box should be selected)



Now Click on the Generate Token Button.



Now Copy the generated token (save the token safely)



Step 2 Configure Token to Git.


Now open your GitHub repo, copy the address, and paste it on the notepad.



Now Just add the token and @ symbol in the copied address as mentioned. 

git remote add origin https://[Token]@github.com/imersandeep/imersandeep.git


Now Go to Git bash paste the address and Click on Enter

 


Woohhh !!! Your git is connected to GitHub Now you can push your code to GitHub.


Hope !!! The above Tutorial on how to connect the Git repository to the GitHub repository is helpful for you...

Team,
QA acharya

Post a Comment

0 Comments