首先在gitee或GitHub 官网申请一个账号,申请步骤略过,不在演示
英文不太好,后续代码都搬到了gitee(码云),因为gitee提供了免费的私有仓库,而且国内服务器网速比较快,比如有些项目代码是比较敏感的,最后选择了gitee,国人嘛
第一部分
注册完毕后,创建一个仓库名为:test1
其他选项可以默认,点击创建即可。
git下载
https://www.git-scm.com/download/
git安装
除了根据个人喜好设置安装路径以外,其他安装一顿下一步,不要浪费时间看为什么(具体的坑以躺过)
下面步骤如有疑问普及一下git知识移步:https://www.runoob.com/git/git-tutorial.html
上述完毕开整~~~
找到一个自己规划好的仓库文件夹,我的是D:\data\GitReposity
初次运行 Git 前的配置
git config --global user.name "John Doe" -- gitee 登录名(查看设置->登录历史)
git config --global user.email johndoe@example.com -- gitee邮箱
git config --list 查看配置信息
ssh密钥设置
ssh-keygen -t rsa -C "youremail@example.com" 一路下一步
会在“C:\Users\xxx个人用户目录\.ssh” 目录生成两个文件
用记事本打开id_rsa.pub,复制内容,后续步骤,点击下面链接(设置完记得回来)
https://gitee.com/help/articles/4191#article-header0
克隆仓库到本地(通过HTTPS协议)
本地git窗口执行
git clone https://gitee.com/xxx/xxx.git (上步复制链接)
本地下载test1仓库截图
测试一把,在test1目录新建一个wmm.txt 文件
模拟你新写的代码 wmm.txt 提交到gitee上,具体步骤如下:
git add . # 添加文件本目录所有文件
git commit -m "添加 wmm.md" # 提交并备注信息
git pull origin master #同步,也可以称之为拉取
git push origin master #推送代码至gitee
查看gitee仓库(记得刷新)
上述步骤说明git 到 gitee已经打通,下面是intellij设置(安装gitee插件,配置git)
打开intellij 选择File->Settings (后面直接上图不解释)
gitee 登录名(gitee上查看设置->登录历史)
配置完毕记得重启intellij,下面打开git下载的test1仓库,复制git链接
第二部分
1.链接地址,2.本地目录
一路下一步即可
新建一个文件:wmm_test.txt
下面进行一次实际中项目创建上传
第三部分
首先,gitee创建一个完全空的库
创建完毕后,在项目中手动创建README.md,LICENSE,.gitignore文件
README.md --项目说明
# 这是一个NB的项目
## 牛不牛逼, 用心去感受
LICENSE 普及一下:https://baike.baidu.com/item/MIT%E8%AE%B8%E5%8F%AF%E8%AF%81/6671281?fr=aladdin
The MIT License (MIT)
Copyright (c) 2014 connors and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.gitignore --不需要上传的文件和目录
node_modules
.idea
.vscode
.git
创建完毕:
后续命令:(不在解释)
git init
git status
git add .
git status
git commit -m "注释"
git remote add origin https://gitee.com/xxx/xxx.git #复制即可
git push -u origin master
完毕!!!
登录gitee,查看仓库,创建完毕留个脚印,谢谢!!!
如果这涉及项目导入可查看第二部分内容即可