Table of Content
To start the process of Create a Repository & Push Code To GitHub First Time, first I want to tell you some more about GitHub and git version control. Git is mainly used for the collaboration of the projects and track the file changes. Before we start, we need 2 important things first,
- GitHub Account (Create from here https://github.com/join)
- Git Bash Tool (If Windows OS) or Terminal (Linux)
Create a New Repository on GitHub
After create an account on GitHub, click to the (+) icon then click on “New repository” to create a new repository.
After click on the “New repository” link, you got the form where you have to fill out the name of the repo, access permission like a public or private and add a readme file to set the details about your project.
After that you got your new repository which look like this,
Push Code To GitHub First Time
According to the above image you have to copy the repository link by clicking on the green “Code” icon. After copy the link, open git bash on your windows machine and run the git clone command.
git clone https://github.com/bikashkrpanda/TestRepo.git
When you clone any repo the first time you got this authentication prompt, click on the sign-in button and authenticate by entering the user ID and password then the clone will be successful.
After cloning the repo you got the directory like this.
Main Points to Push Code To GitHub First Time
- Open the directory where you clone the Repository.
- Copy the files which you want to push.
- Paste those files on the repo directory which is created at the time of cloning.
- Then go to the Git Bash and enter the same directory by
After putting the files, on my case I paste one test file on it.
Now we check file using Git Bash and start pushing files using git commands.
Here are all the steps to push files on GitHub,
- Check Repo Status:
git status(To check modified or newly added files)
- Add Files:
git add fileOne.php fileTwo.php(Add modified or newly added files)
- Git Commit:
git commit -m "Write message about files"
- Check current branch:
- Push files on a branch:
git push origin yourBranchName
After complete the above process the final repository look like this.
Using same command you can update or add new files on your repository.
Here is complete visual guide to Create a Repository and Push Code To GitHub First Time. If you have facing any issue with the above steps please comment below.
- Login with Google Account using PHP Step by Step
- Save contact form data in CSV file using PHP
- How to Embed PDF in Website Using HTML