1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/content/github/managing-files-in-a-repository/adding-a-file-to-a-repository-using-the-command-line.md
Jason Etcovitch caaee7a124 Update all files to use {% data %} (#15253)
* Add back changes from prior to purge

* Manually fix some invalid Liquid

* Updoot render-content

* Improve test messages to show correct output

* Run el scripto

* Pass the remaining test
2020-09-29 16:01:04 -04:00

1.6 KiB

title, intro, redirect_from, versions
title intro redirect_from versions
Adding a file to a repository using the command line You can upload an existing file to a {% data variables.product.product_name %} repository using the command line.
/articles/adding-a-file-to-a-repository-from-the-command-line/
/articles/adding-a-file-to-a-repository-using-the-command-line
free-pro-team enterprise-server
* *

{% tip %}

Tip: You can also add an existing file to a repository from the {% data variables.product.product_name %} website.

{% endtip %}

{% data reusables.command_line.manipulating_file_prereqs %}

{% data reusables.repositories.sensitive-info-warning %}

  1. On your computer, move the file you'd like to upload to {% data variables.product.product_name %} into the local directory that was created when you cloned the repository. {% data reusables.command_line.open_the_multi_os_terminal %} {% data reusables.command_line.switching_directories_procedural %} {% data reusables.git.stage_for_commit %}
$ git add .
# Adds the file to your local repository and stages it for commit. {% data reusables.git.unstage-codeblock %}

{% data reusables.git.commit-file %}

$ git commit -m "Add existing file"
# Commits the tracked changes and prepares them to be pushed to a remote repository. {% data reusables.git.reset-head-to-previous-commit-codeblock %}

{% data reusables.git.git-push %}

Further reading