0
点赞
收藏
分享

微信扫一扫

使用linux上传代码到gitee

(文章目录)

一、 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]$ ls
main.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]$ ls
main.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]$ ls
ConsoleApplication1 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]$ ls
ConsoleApplication1 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 add

git add * 

使用 git add * 将所有没有添加过去的都添加过去。

4. git commit

git commit -m 对于代码的简介

将本地代码添加到本地仓库中

正常情况

在这里插入图片描述

出现红框的现象为正常情况

异常情况

在这里插入图片描述

若出现红框现象,则为异常情况

输入以下两句话,再重新输入 git commit -m "你的代码简介” ,即可正常运行

git config --global user.email 你的绑定gitee的邮箱
git config --global user.name 你的gitee名字

在这里插入图片描述

红框为你的gitee名字

在这里插入图片描述

红框为你的gitee绑定邮箱

5. git push

git push

上传到gitee上

在这里插入图片描述

输入绑定gitee的手机号与gitee密码

在这里插入图片描述

出现如下则说明上传成功

举报

相关推荐

0 条评论