How Do I Upload My Exsiting Folder to Github From Local Drive
GitHub is simply a cloud-hosted Git management tool. Git is distributed version command, meaning the unabridged repo and history lives wherever you put information technology. People tend use GitHub though in their concern or development workflow every bit a managed hosting solution for backups of their repositories.
It'due south a convenient and mostly worry-free method for backing up all your lawmaking repos. Information technology also allows you lot to very nicely navigate and view your lawmaking on the web. GitHub takes this even further by letting you connect with coworkers, friends, organizations, and more.
Prerequisites:
To initialize the repo and push button information technology to GitHub you'll need:
- A free GitHub Account
-
gitinstalled on your local car
Step i: Create a new GitHub Repo
Sign in to GitHub and create a new empty repo page. You can cull to either initialize a README or not. It doesn't really matter because we're but going to override everything in this remote repository anyways.
Through the rest of this tutorial nosotros'll assume your GitHub username is sammy and the repo you created is named my-new-projection (So you'll need to swap those out with your actual username and repo name when copy/pasting commands)
Pace 2: Initialize Git in the project folder
From your last, run the following commands afterward navigating to folder you would similar to add:
Initialize the Git Repo
Make sure y'all are in the root directory of the projection you want to push to GitHub and run:
Note: if you already have an initialized Git repository, y'all can skip this command
- git init
This footstep creates a subconscious .git directory in your project folder which the git software recognizes and uses to store all the metadata and version history for the projection.
Add together the files to Git index
- git add -A
The git add command is used to tell git which files to include in a commit, and the -A argument ways "include all".
Commit Added Files
- git commit -g 'Added my projection'
The git commit command creates a new commit with all files that have been "added". the -thousand 'Added my project' is the bulletin that will be included alongside the commit, used for hereafter reference to sympathise the commit.
Add new remote origin (in this case, GitHub)
- git remote add origin git@github.com:sammy/my-new-project.git
Notation: Don't forget to replace the highlighted bits in a higher place with your username and repo name.
In git, a "remote" refers to a remote version of the same repository, which is typically on a server somewhere (in this case GitHub.) "origin" is the default proper name git gives to a remote server (you can have multiple remotes) so git remote add origin is instructing git to add the URL of the default remote server for this repo.
Push to GitHub
- git push button -u -f origin chief
With this, there are a few things to note. The -f flag stands for force. This will automatically overwrite everything in the remote directory. We're only using it here to overwrite the README that GitHub automatically initialized. If you skipped that, the -f flag isn't actually necessary.
The -u flag sets the remote origin as the default. This lets you lot later easily only do git push and git pull without having to specifying an origin since nosotros ever want GitHub in this case.
All together
- git init
- git add together -A
- git commit -m 'Added my project'
- git remote add origin git@github.com:sammy/my-new-project.git
- git push -u -f origin master
Conclusion
Now you are all prepare to track your code changes remotely in GitHub! Every bit a side by side step hither'southward a complete guide to how to apply git
Once you first collaborating with others on the project, you'll want to know how to create a pull request.
Source: https://www.digitalocean.com/community/tutorials/how-to-push-an-existing-project-to-github
Post a Comment for "How Do I Upload My Exsiting Folder to Github From Local Drive"