How To Upload A Code In Github
Adding a file to a repository on GitHub
Files that you add together to a repository via a browser are express to 25 MB per file. You lot can add larger files, upward to 100 MB each, via the command line. For more data, come across "Calculation a file to a repository using the command line."
Tips:
- You can upload multiple files to GitHub at the same time.
- If a repository has whatever protected branches, you can't edit or upload files in the protected branch using GitHub. For more information, see "About protected branches."
Y'all can use GitHub Desktop to motion your changes to a new branch and commit them. For more than information, run across "Committing and reviewing changes to your project."
- On GitHub.com, navigate to the main folio of the repository.
- Above the list of files, using the Add file drop-downward, click Upload files.
- Elevate and driblet the file or folder yous'd like to upload to your repository onto the file tree.
- At the bottom of the folio, type a short, meaningful commit message that describes the change you made to the file. You can aspect the commit to more one author in the commit message. For more information, run into "Creating a commit with multiple co-authors."
- Beneath the commit bulletin fields, decide whether to add your commit to the current branch or to a new branch. If your current co-operative is the default branch, yous should choose to create a new branch for your commit and then create a pull request. For more information, run into "Creating a new pull request."
- Click Commit changes.
Calculation a file to a repository using the command line
You can upload an existing file to a repository on GitHub.com using the command line.
This procedure assumes you've already:
- Created a repository on GitHub, or have an existing repository endemic past someone else you'd like to contribute to
- Cloned the repository locally on your computer
Warning: Never git add
, commit
, or push
sensitive data to a remote repository. Sensitive information tin can include, merely is not limited to:
- Passwords
- SSH keys
- AWS access keys
- API keys
- Credit card numbers
- Pin numbers
For more information, see "Removing sensitive data from a repository."
- On your computer, move the file you'd like to upload to GitHub into the local directory that was created when yous cloned the repository.
- Open up Terminal Terminal Git Bash.
- Change the current working directory to your local repository.
- Stage the file for commit to your local repository.
$ git add . # Adds the file to your local repository and stages it for commit. To unstage a file, use 'git reset Head YOUR-FILE'.
- Commit the file that y'all've staged in your local repository.
$ git commit -m "Add existing file" # Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, utilise 'git reset --soft HEAD~1' and commit and add the file again.
- Push the changes in your local repository to GitHub.com.
$ git push origin your-branch # Pushes the changes in your local repository up to the remote repository you specified equally the origin
Farther reading
- "Adding locally hosted code to GitHub"
Source: https://docs.github.com/articles/adding-a-file-to-a-repository
Posted by: ostlundjoind1977.blogspot.com
0 Response to "How To Upload A Code In Github"
Post a Comment