How to upload a new project into a new github repository
Today I’m going to show you some basic commands that can be used to upload our working project into a new repository on GitHub. Because of GitHub becomes a very popular version controlling system, I thought it may be very useful to you.
- git clone repository URL
- git status
- git add .
- git commit –m “message”
- git push
Now we look at what is done by each command.
- git clone repository URL – This command copies the existing repository.
- git status – Displays the state of the working directory and the staging area.
- git add . – Adds changes in the working directory to the staging area.
- git commit- Save your changes to the local repository.
- git push – Upload local repository content to a remote repository.
So, Now we look at how to add a project to a GitHub. So, the first login to your GitHub account and create a new repository. Then copy the URL of the repository.
Create a new repository in GitHub
Clone a new git repository
Then go back to your working folder and open git bash (or command window). After opening the git bash run command, git clone ‘URL’ of the repository’.
It will create creates a copy of the GitHub repository.
Find status of the working directory
Then, go to the newly created folder and put your workings here. As an example, I create a simple text file. Then, open GitBash in the new folder and run command, ‘git status’. It will show the current state of the working directory.
Add changes to the staging area
Then, run ‘git add .’ and it adds changes in the working directory to the staging area.
Commit to GitHub
After adding changes into working directory run, git commit –m “message”. Also, You can write any thing as the message.
So, it It will save changes to the local repository.
Push to GitHub
Finally, run git push.
Git push command will upload local repository content to the remote repository. Okay, now your project is in the GitHub. Run last four commands after completing each version of your project. It will upload each version of your project to GitHub.
You will meet a lot of git commands when you controlling versions of your projects with GitHub. But in this case, my objective was teaching very basics commands that can be used to start working with GitHub. Thanks for reading.