1 git config --global user.name "laolang205"
2 git config --global user.email "dxyang@kaikeba.com"
1 cd /path/to/myworkspace
2 git init
3 git add src
4 git add pom.xml
5 git add assembly.xml
6 git commit -m "commit message"
6:pull远程到本地 $ git pull https://github.com/guojiangshan/canyin master warning: no common commits remote: Counting objects: 5, done. remote: Compressing objects: 100% (4/4), done. remote: Total 5 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (5/5), done. From https://github.com/guojiangshan/canyin * branch master -> FETCH_HEAD Merge made by the 'recursive' strategy. .gitignore | 11 ++ LICENSE | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 + 3 files changed, 354 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md
7:设置 git ignore 过滤文件,.class 后缀文件不提交到远程 $ echo *.class>.gitignore 查看设置是否成功: $ cat .gitignore *.class
8:再次push,成功 $ git push https://github.com/guojiangshan/canyin master Username for 'https://github.com': guojiangshan Password for 'https://guojiangshan@github.com': Counting objects: 116, done. Delta compression using up to 4 threads. Compressing objects: 100% (102/102), done. Writing objects: 100% (115/115), 58.02 KiB | 0 bytes/s, done. Total 115 (delta 6), reused 0 (delta 0) To https://github.com/guojiangshan/canyin f7ddeea..5fd03b6 master -> master
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/laolang205/lalala.git
git push -u origin master
git remote add origin https://github.com/laolang205/lalala.git
git push -u origin master