you're reading...
Tech

Adding files to a repository from the command line

You can upload an existing file to a GitHub repository using the command line.

Tip: You can also add an existing file to a repository from the GitHub website.

This procedure assumes you’ve already:

  1. On your computer, move the file you’d like to upload to GitHub into the local directory that was created when you cloned the repository.
  2. Open Terminal.
  3. Change the current working directory to your local repository.
  4. Stage the file for the first commit to your repository.
    git add .
    # Adds the files in the local repository and stages them for commit. 
    
  5. Commit the files that you’ve staged in your local repository.
    git commit -m "First commit"
    # Commits the tracked changes and prepares them to be pushed.
    
  6. Push the changes in your local repository to GitHub.
    git push origin master
    # Pushes the changes in your local repository.

     

    Org: Github Help

 

 

 

Advertisements

About Admin

#WP #D

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: