Skip to content

Instantly share code, notes, and snippets.

@z2015
Created May 2, 2016 02:38
Show Gist options
  • Select an option

  • Save z2015/4d0d6f30ffc9bed7ca1dcefe876c0d8f to your computer and use it in GitHub Desktop.

Select an option

Save z2015/4d0d6f30ffc9bed7ca1dcefe876c0d8f to your computer and use it in GitHub Desktop.
git推送本地文件到github仓库初始化
git init
git add .
# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
git remote add origin remote repository URL
# Sets the new remote
git remote -v
# Verifies the new remote URL
git push origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin
#如果github远程仓库有多余本地仓库的其他文件,需先进行git pull origin master , 再执行git add命令
//https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment