1.进入GitHub官网(https://github.com/)注册账号并激活。
2.登录github账号后创建项目仓库,点击new repository,在Repository name填入项目仓库名,如JavaTest,其与你要导入的项目名称一致,点击Create repository完成创建。



3.进入Linux系统,打开终端,进入到项目的目录,如笔者将项目放在Desktop目录下的。
cd myweb

4.将本地项目纳入Git版本管理,代码中“ ”中的内容随意,只是一些说明。
git init
git add -A
git commit -m "Initial commit"

5.将项目推送到github上,其中username为你的用户名,myweb为项目名,后面的链接相当于下图的链接,可从github获得。

git remote add origin https://github.com/<username>/myweb.git
git push -u origin master
然后输入github的用户名(不是邮箱)和密码即可。

6.打开自己的github主页,查看其中的项目,发现已经上传成功。