To add new files to a remote GitHub repository, you can use the command line (Git Bash, Terminal) for a local workflow or the GitHub website for a quick web interface upload. [1, 2]
Method 1: Using the Command Line (Recommended for projects)
This method assumes you have Git installed, the repository cloned locally, and are in the local repository's directory.
- Move the new file(s) into your local repository's directory.
- Stage the files for the next commit using the command:
- To add a specific file:
- To add all new and modified files:
- Commit the staged files to your local repository with a descriptive message:
- Push the changes from your local repository to the remote GitHub repository:
Method 2: Using the GitHub Web Interface (For small additions)
This method is useful for adding a few small files without using the command line.
- Navigate to your repository on the GitHub website.
- Above the list of files, select the dropdown menu and click .
- Drag and drop your file or folder into the browser window, or click to browse your local machine.
- Type a short, meaningful commit message in the "Commit changes" field at the bottom of the page.
- Click (or if you are working on a new branch) to finalize the upload. [1, 8]
.png)
No comments:
Post a Comment