(文章目录)
一、 git的安装sudo yum -y install git检查是否安装成功git –version(这个是输入)git version 1.8.3.1 (若安装成功会自动弹出)二、过程1. 仓库链接
首先登录gittee,进入仓库,并找到克隆/下载
点击下载后,找到HTPPS并复制链接
2.linux中的操作
进入你想要传的文件目录中
[yzq@VM-8-8-centos ~]$ cd mk[yzq@VM-8-8-centos mk]$ lsmain.c makefile mytest.c mytets.c test.h
此时我想要传如上文件内容
1. git clone[yzq@VM-8-8-centos mk]$ git clone https://gitee.com/yaozhiqi123456/the-new-warehouse.git
git clone +复制链接
[yzq@VM-8-8-centos mk]$ lsmain.c makefile mytest.c mytets.c test.h the-new-warehouse
此时ls命令, 就会把你的仓库名字显示出来
1. 进入仓库
进入你的仓库中
[yzq@VM-8-8-centos mk]$ cd the-new-warehouse[yzq@VM-8-8-centos the-new-warehouse]$ lsConsoleApplication1 main.c makefile Pro.c Pro.h README.en.md README.md
进入你的仓库,此时仓库中是你之前储存的代码,我们需要将现在你想要储存的代码搞进仓库
2. 拷贝代码[yzq@VM-8-8-centos the-new-warehouse]$ cp ../*.c .[yzq@VM-8-8-centos the-new-warehouse]$ cp ../*.h .[yzq@VM-8-8-centos the-new-warehouse]$ lsConsoleApplication1 main.c makefile mytest.c mytets.c Pro.c Pro.h README.en.md README.md test.h
cp .. /*.c .即将上一级目录的所有.c文件都传入当前目录中cp .. /*.h .即将上一级目录的所有.h文件都传入当前目录中
2. git status(可忽略)git status
git status 这是查看代码的状态,看是否之前传过了
若出现 new file 说明并没有传过,当前.c和.h文件以及makefile都不在git中。
3. git addgit add *
使用 git add * 将所有没有添加过去的都添加过去。
4. git commitgit commit -m "对于代码的简介"
将本地代码添加到本地仓库中
正常情况
出现红框的现象为正常情况
异常情况
若出现红框现象,则为异常情况
输入以下两句话,再重新输入 git commit -m "你的代码简介” ,即可正常运行
git config –global user.email "你的绑定gitee的邮箱"git config –global user.name "你的gitee名字"
红框为你的gitee名字
红框为你的gitee绑定邮箱
5. git pushgit push
上传到gitee上
输入绑定gitee的手机号与gitee密码
出现如下则说明上传成功
游手好闲会使人心智生锈