Note: 推荐使用SSH URL,可以不用每次提交都输入密码,需要客户端生成pub/pri key pair,然后通过Web控制台添加pub key到github/setting/SSH and GPG keys中
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ 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
Download/Clone remote github repository to local folder
1
git clone REMOTE-URL LOCAL-FOLDER
for example: git clone git@github.com:aaray6/mytest.git mytest/
to put existing content into repository (merge tips)