Upload local directory codes to a new GitHub repository
To upload your local directory and codes to a fresh GitHub repository, follow these steps:
Initialize a Local Git Repository: Navigate to your local directory using the terminal or command prompt and run:
Add All Files to the Local Repository: Still in the terminal or command prompt, run:
Commit the Changes: Commit the changes you've made with a message describing the initial commit:
Link the Local Repository to the GitHub Repository: Replace
YOUR_GITHUB_REPO_URL
with the URL of your fresh GitHub repository (you can find this URL on the main page of your GitHub repo, it usually looks likehttps://github.com/username/repo-name.git
):
Push the Changes to GitHub: Push your local commits to the GitHub repository:
Verify: Go to your GitHub repository in your web browser and refresh the page. You should now see your local directory and codes uploaded to the repository.
Remember, every time you make changes to your local files and want to update them on GitHub, you'll need to repeat the git add
, git commit
, and git push
steps.
Last updated
Was this helpful?