Latest Updates

Post Top Ad

20 August, 2021

How to Create GitHub Repository & Add File from Git to GitHub

 

Steps to Create Central Repository on GitHub & Add File to GitHub


Follow the steps to create a central repository on GitHub. Upon creation of the central repository, the URL of the central repository can be added to Git Local repository. In this way, we can directly push & pull files from the local git repository to the central GitHub reposirory. 





  • Open GitHub - https://github.com
  • Create a New Repository
  • Get Origin URL
  • Add Remote Repo(GitHub) to Local Repo(Git)
  • Create Personal Access Token on GitHub
  • Push codes to GitHub


1. Open GitHub

     Go to https://github.com and create one Account.
      


    

2. Create a New Repository

 Click on Repository -> New and give a unique name

    

    Select Option - Public and Create Repository



3. Get Origin URL

Click on codes to copy the repository URL.



4. Add Remote Repository (GitHub) to Local Repository (Git)


Command to add origin to remote

git remote add origin https://github.com/piyushprakashpp/centralgit.git



5. Create Personal Action Token on GitHub


To securely send files from Git to GitHub additional tokens need to create. This token would be used to push files from origin to remote i.e from Local Repo to Remote Repo.


 

From your Github account, go to Settings => Developer Settings => Personal Access Token => Generate New Token (Give your password) => Fillup the form => click Generate token => Copy the generated Token, it will be something like ghp_sFhFsSHhTzMDreGRLjmks4Tzuzgthdvfsrta


6. Push codes to GitHub

    git push -u origin master or
    git push origin master

    Here, master is a branch name.


Verify from GitHub if the files are pushed to GitHub







Please subscribe and Like

No comments:

Post Top Ad

Your Ad Spot

Pages