Upload Project/Files On Github Using Command line

Upload Project/Files On Github Using Command line

Upload file to github command line. Today we will learn how to easily upload project or file on github using command line. First we will create a new repository on github and after we will fill the repository name and description.

Upload Project/Files On Github Using Command line

Follow the few steps and successfully upload file or project on github using command line.

Step 1 – Create New Repository

We need to create a new repository on GitHub website. Go to link and create repository click here . Click New repository from the menu on your right once you are logged into your GitHub account.

add new repository

Create new repository On Github

Fill the repository name and description of your project.

create git project

Step 2 – Now Open cmd

Now go to the Terminal on your computer system. Use cd to navigate to the local project directory that you want to publish on GitHub.

CD to navigate to your directory

cd/your_directory_name

Step 3 – Initialize Local Directory

Now we will intialize our project. Use the below command to initialise the local directory as Git repository.

git init

Step 4 – Add Local repository

Add all the files in the local directory to staging using the command below.

git add . 

This command stages all the files in the directory, ready for commit.

Step 5 – Commit Repository

You can now commit the staged files using the command below. It is explanatory and helpful.

git commit -m "First commit Message"

Step 6 – Add Remote Repository url

Now, copy the remote repository URL provided by github to you when you published your repository on GitHub.

git repository url

Now we will add the copied URL for your GitHub repository as remote repository using the code below.

git remote add origin https://github.com/yourusername/your-repo-name.git

This command add our GitHub repository as a remote that you can then push your local repository changes.

Step 7 – Push Local Repository to github

In the last step, use the below command line in your terminal to push the local repository to GitHub. It will upload the file or project on github.

git push origin master

If you use -u in the command, it will remember your preferences for remote and branch and you can simply use the command git push next time.

git push -u origin master

Step 8 – Pull Repository from github

Pull the desired branch from the upstream repository. This method will retain the commit history without modification.

git pull origin master

All the command to use upload the file and projects on github.

 cd/your project directory

1) git init
2) git add . or git add ['filename']
3) git commit -m "My first File"
4) git remote add origin https://github.com/yourusername/your-repo-name.git
5) git pull origin master
6) git push origin master

In just few minutes. We have successfully upload the project or file on github using command line

Recommended Tutorials

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

7 replies to Upload Project/Files On Github Using Command line

  1. can u tell me how can i upload and run my codeigniter in github????

  2. this is very useful thanku.

  3. Thank you so much!!!!

  4. Very useful article. Thank you very much.

  5. Thanks a lot for the support and help

  6. Thanks, very useful article. very easy to understand.

Leave a Reply

Your email address will not be published. Required fields are marked *