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 nosotros will create a new repository on github and afterwards we volition fill the repository proper name and clarification.

Upload Project/Files On Github Using Control line

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

Step i – Create New Repository

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

add new repository

Create new repository On Github

Make full the repository name and description of your project.

create git project

Pace 2 – At present Open up cmd

Now get to the Last on your computer system. Use cd to navigate to the local project directory that yous want to publish on GitHub.

CD to navigate to your directory

cd/your_directory_name

Step iii – Initialize Local Directory

Now we volition intialize our project. Use the beneath control to initialise the local directory every bit 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 control stages all the files in the directory, ready for commit.

Step v – Commit Repository

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

git commit -thou "First commit Bulletin"

Stride 6 – Add together Remote Repository url

At present, copy the remote repository URL provided past github to yous 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 lawmaking below.

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

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

Step 7 – Push Local Repository to github

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

git push origin master

If you employ -u in the command, it volition remember your preferences for remote and branch and you can simply use the command git push button adjacent time.

git push button -u origin principal

Step 8 – Pull Repository from github

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

git pull origin master

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

                  cd/your project directory

1) git init
2) git add together . or git add together ['filename']
3) git commit -g "My first File"
4) git remote add origin https://github.com/yourusername/your-repo-name.git
five) git pull origin master
half-dozen) git push origin main

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

Recommended Tutorials

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of 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 from a starting stage. Too as demo case.

View all posts by Admin