github教程:
https://git-scm.com/book/zh/v2
http://blog.csdn.net/tangbin330/article/details/9128765
windows上下載地址:
https://git-for-windows.github.io
使用的git服務:
https://git.oschina.net
教程:
https://my.oschina.net/dxqr/blog/134811
反正是成功了。
順序:
1配置用戶名,郵箱
$ git config --global user.name langxxxx
Administrator@PC201607041048 MINGW64 ~
$ git config --global user.email "[email protected]"
2然後檢查一下配置:
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.required=true
gui.recentrepo=D:/work/word/xxxx/pantilt/PanTilt
user.name=langxxxx
[email protected]
3.先進入到這個項目目錄:
Administrator@PC201607041048 MINGW64 ~ (master)
$ cd D:/work/word/xxxx/pantilt/PanTilt
.再git init
Administrator@PC201607041048 MINGW64 /d/work/word/xxxx/pantilt/PanTilt (master)
$ git init
4.git add .
5.git commit -m "GitHelloWorld first commit"
6.ssh-keygen -t rsa -C "[email protected]"
7.ssh -T [email protected]
8.git remote add origin http://git.oschina.net/whaon/none.git
9.git push origin master
完畢!
注意:
$ git push origin master 可能會出下面的錯,那是因爲你上傳過radme文件
Username for 'http://git.oschina.net': langxiuming
To http://git.oschina.net/langxiuming/pantilt.git
! [rejected] master -> master (fetch first)
所以,你要先更新一下:
$ git pull --rebase origin master
Username for 'http://git.oschina.net': langxxxx
warning: no common commits
注意輸密碼的時候,別輸入到git bash 裏,我試了兩次不行,後來發現的。。。
提交代碼:
1.git add .
2.git commit -m "描述"
3.git push 或者git push master 或者git push origin master. 注意其中要關聯一下。 git branch --set-upstream master origin/master
下載代碼:
1.git pull