一、提交
1、下载好git
2、将git账户和本地相关联:ssh-keygen -t rsa -C “你的邮箱”
3、查看密钥:cat ~/.ssh/id_rsa.pub
4、将密钥设置在码云上:官网中—个人—设置—ssh公钥—公钥文本域
5、码云上创建好远程仓库后,在本地要上传的文件夹中打开git,然后进行相应配置:
git config –global user.name “你的名字或昵称”
git config –global user.email “你的邮箱”
6、完成后就可以创建本地仓库:git init
7、输入链接地址:git remote add origin 码云仓库地址
8、接下来就可以正常的使用git进行提交了:
(1)git add .
(2)git commit -m “xxx”
(3)git push origin master (第一次提交时执行:git push -u origin master)
二、下载
1、在要下载的位置输入:git clone url
2、同步代码:git pull
三、常用
git init | 初始化仓库 |
git clone | 下载项目 |
git add | 添加文件到暂存区 |
git status | 查看当前仓库状态,显示被变更文件 |
git diff | 查看暂存区和工作区的差异 |
git commit | 提交暂存区到本地仓库 |
git reset | 回退版本 |
git log | 查看历史提交记录 |
git pull | 下载远程代码并合并 |
git push | 上传远程代码并合并 |
git branch -a | 查看所有分支 |
git checkout 分支名 | 切换分支 |
git merge 原分支 目标分支 | 合并分支(合并分支代码) |
git rm | 删除工作区文件 |
git mv | 移动或重命名工作区文件 |
I like the helppful information you proide in your articles.
I’ll bookmark your weblog aand check again here regularly.
I’m quie sure I’ll leqrn lots of new stuff right here!
Good luck for the next!
Feel free to visut myy web site SEO продвижение сайта с гарантией