Skip to content

Instantly share code, notes, and snippets.

@shad0wuser
Forked from arn-ob/gitUpload.txt
Last active February 2, 2018 21:12
Show Gist options
  • Save shad0wuser/55aab8ce00e98c2514e6eb165b0c44e3 to your computer and use it in GitHub Desktop.
Save shad0wuser/55aab8ce00e98c2514e6eb165b0c44e3 to your computer and use it in GitHub Desktop.
Git Repository Upload Command

Add the files in your new local repository. This stages them for the first commit.

Change the current working directory to your local project. Initialize the local directory as a Git repository.

git init

Setting your commit email address and username in Git

git config user.email "email@example.com"
git config --global user.name "Your Name"

Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.

git add .

Commits the tracked changes and prepares them to be pushed to a remote repository.

Commit the files that you've staged in your local repository.

git commit -m "First commit"

To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.

Sets the new remote

In the Command prompt, add the URL for the remote repository where your local repository will be pushed. Copy remote repository URL field at the top of your GitHub repository's Quick Setup page, click to copy the remote repository URL.

git remote add origin remote [repository URL]

Verifies the new remote URL

git remote -v

Pushes the changes in your local repository up to the remote repository you specified as the origin

Push the changes in your local repository to GitHub.

git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment