当前位置:   article > 正文

使用linux上传代码到gitee_虚拟机linux使用git导出gitee

虚拟机linux使用git导出gitee

一、 git的安装

sudo yum -y install git
  • 1

检查是否安装成功

git --version(这个是输入)
git version 1.8.3.1 (若安装成功会自动弹出)	

  • 1
  • 2
  • 3

二、过程

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
  • 2
  • 3

此时我想要传如上文件内容

1. git clone

[yzq@VM-8-8-centos mk]$  git clone https://gitee.com/yaozhiqi123456/the-new-warehouse.git
  • 1

git clone +复制链接

[yzq@VM-8-8-centos mk]$ ls
main.c  makefile  mytest.c  mytets.c  test.h  the-new-warehouse

  • 1
  • 2
  • 3

此时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

  • 1
  • 2
  • 3
  • 4

进入你的仓库,此时仓库中是你之前储存的代码,我们需要将现在你想要储存的代码搞进仓库

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
  • 1
  • 2
  • 3
  • 4

cp ../*.c .即将上一级目录的所有.c文件都传入当前目录中
cp ../*.h .即将上一级目录的所有.h文件都传入当前目录中

2. git status(可忽略)

git status
  • 1

git status 这是查看代码的状态,看是否之前传过了

在这里插入图片描述

若出现 new file 说明并没有传过,当前.c和.h文件以及makefile都不在git中。

3. git add

git add * 
  • 1

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

4. git commit

git commit -m "对于代码的简介"
  • 1

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

正常情况

在这里插入图片描述

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

异常情况

在这里插入图片描述

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

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

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

在这里插入图片描述

红框为你的gitee名字

在这里插入图片描述

红框为你的gitee绑定邮箱

5. git push

git push
  • 1

上传到gitee上

在这里插入图片描述

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

在这里插入图片描述

出现如下则说明上传成功

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/477135
推荐阅读
相关标签
  

闽ICP备14008679号