How to Connect Git to GitHub Repository Step by Step

.

 GIT and Git Hub Configuration


Your first time with Git and GitHub


How to Connect Git to GitHub



Step 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 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 on your local Machine. (You can use your existing folder also)




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




Now Right 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 to the staging area).



Now run a git Command: git commit -m "message"




Wow!!! You have successfully set the git on 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 the GitHub repo, just follow the steps below.

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 steps below

Click on your GitHub profile.




Now, Click on the Settings Option 



Scroll down the page and click on the developer settings 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 boxes 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