github下载地址: https://git-for-windows.github.io/
下载完成后,一路next即可
第一步:创建一个本地的版本库(就是创建一个文件夹)
第二步:使用git init 命令将新创建的文件夹变成可管理的仓库(github在本地安装完成后,在任意文件夹中点右键会多出Git Base here和Git Gui here选项)
完成git init操作后,在这个文件夹中会多了一个.git的隐藏文件
第三步:将想要发布到github上的工程copy到这个文件夹中
例如:我传的是一个普通java工程
将项目复制过来以后,使用git status可以查看状态,如下:
意思是说,虽然你将项目copy到文件夹中,但是还没有提交到仓库中
第四步:使用git add . 命令将所有文件添加到仓库中,再使用git commit -m "这里是自己添加的注释"命令完成提交
第五步:本地仓库建好后,需要到github官网上登录自己的账号,建立一个远程仓库
跳转到下面的页面
第六步:远程仓库准备完毕后,使用git remote add origin https://github.com/liujiaxin1314/test.git,将本地仓库与远程仓库进行关联。
这时会报一个,这是因为新建远程仓库时,点选了Initialize this repository with a README,导致新建的仓库中的README文件不在本地仓库目录中,我们可以通过git pull --rebase origin master命令进行合并。
第七步:使用git push -u origin master命令,将本地仓库内容推送到github上,由于是第一次上传,远程仓库中没有内容,所以需要加上-u,如果是以后修改远程仓库中的内容,可以删掉-u,直接用git push origin master命令即可。
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git
https://github.com/liujiaxin1314/test.git