前提是你已经有了自己的github账号,并且已经关联了本地和远程的仓库,设置好了ssh密钥。自行百度解决。
上传的主要命令:
git init git add . git commit -m "备注的信息" //关联到远程的仓库 git remote add origin https://github.com/Alanrah/WebGL-.git //上传到远程仓库 git push origin master
这是我的上传大致的过程,有兴趣可以看看。
// MyHtmlCss是我要上传的文件的目录,目录下是要上传的文件 Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/FrontEndSrc/MyHtmlCss (master) $ git init Initialized existing Git repository in D:/FronteEnd/FrontEndSrc/MyHtmlCss/.git/ Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/FrontEndSrc/MyHtmlCss (master) $ git add .(注意,add后面是空格和点号) Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/FrontEndSrc/MyHtmlCss (master) $ git remote add origin https://github.com/Alanrah/MyHtmlCSS.git Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/FrontEndSrc/MyHtmlCss (master) $ git commit -m "my first commit myhtmlcss"(引号内为本次上传的信息) [master (root-commit) 2dd1125] my first commit myhtmlcss 60 files changed, 4618 insertions(+) create mode 100644 "CSS3-\345\270\246\350\203\214\346\231\257\345\210\207\346\215\242\347\231\273\351\231\206\346\263\250\345\206\214\350\241\250\345\215\225/css/style.css" …… create mode 100644 "\346\226\207\346\234\254\345\212\240\345\257\206.html" create mode 100644 "\347\273\277\350\217\212.html" create mode 100644 "\351\227\252\347\203\201\350\255\246\347\244\272\347\201\257.htm" Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/FrontEndSrc/MyHtmlCss (master) $ git push origin master Counting objects: 82, done. Delta compression using up to 4 threads. Compressing objects: 100% (74/74), done. Writing objects: 100% (82/82), 621.91 KiB | 0 bytes/s, done. Total 82 (delta 3), reused 0 (delta 0) remote: Resolving deltas: 100% (3/3), done. To https://github.com/Alanrah/MyHtmlCSS.git * [new branch] master -> master Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/FrontEndSrc/MyHtmlCss (master) $ //ok,到这里该仓库上传完毕 //现在以同样的方法上传仓库: Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/WebGL/webGL中文网站基础教程学习 $ git init Initialized empty Git repository in D:/FronteEnd/WebGL/webGL中文网站基础教程学习/.git/ Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/WebGL/webGL中文网站基础教程学习 (master) $ git add . warning: LF will be replaced by CRLF in js/d3.js. The file will have its original line endings in your working directory. The file will have its original line endings in your working directory. …… warning: LF will be replaced by CRLF in src/lesson15/index.html. The file will have its original line endings in your working directory. Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/WebGL/webGL中文网站基础教程学习 (master) $ git commit -m "WebGL中文教程代码" [master (root-commit) 858abfa] WebGL中文教程代码 69 files changed, 140515 insertions(+) create mode 100644 js/d3.js create mode 100644 js/three.min.js …… create mode 100644 src/nehe.gif create mode 100644 "three.js\347\232\204\350\207\252\345\255\246\345\237\272\347\241\200.doc" Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/WebGL/webGL中文网站基础教程学习 (master) $ git remote add origin https://github.com/Alanrah/WebGL-.git Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/WebGL/webGL中文网站基础教程学习 (master) $ git push origin master Counting objects: 74, done. Delta compression using up to 4 threads. Compressing objects: 100% (71/71), done. Writing objects: 100% (74/74), 5.31 MiB | 145.00 KiB/s, done. Total 74 (delta 13), reused 0 (delta 0) remote: Resolving deltas: 100% (13/13), done. To https://github.com/Alanrah/WebGL-.git * [new branch] master -> master Catherine@DESKTOP-GP6IPQS MINGW64 /d/FronteEnd/WebGL/webGL中文网站基础教程学习 (master) $