zoukankan      html  css  js  c++  java
  • Ubuntu配置Git并利用Gitee(码云)进行项目及代码的管理

    Ubuntu配置Git并利用Gitee(码云)进行项目及代码的管理

    git安装与卸载

    apt-get install git apt-get remove git

    git配置

    配置用户名
    git config --global user.name “your name”
    配置邮箱
    git config --global user.email “your email”
    查看配置信息
    git config --global --list
    生成公钥
    ssh-keygen -t rsa -C "your email"
    生成公钥后在ssh相应目录中将id_rsa.pub中的内容拷贝至码云
    在这里插入图片描述
    测试配置是否成功
    ssh -T git@gitee.com

    代码推送的流程

    1、初始化一个仓库:git init

    2、增加代码后,添加:git add .

    3、提交代码到仓库:git commit -m "related_message"

    4、添加远程仓库地址,这里就是添加在gitee上建立的仓库地址

    git remote add origin https://gitee.com/****/****.git

    5、把本地仓库推到远程存储仓库中
    git push origin master

    git提交代码(从仓库克隆修改后)

    将你本地所有修改了的文件添加到暂存区
    git add .
    将更改内容和日志消息一起存储在新的提交中
    git commit -m "update"
    下拉代码,将远程最新的代码先跟你本地的代码合并一下,如果确定远程没有更新,可以不用这个,最好是每次都执行以下,完成之后打开代码查看有没有冲突,并解决,如果有冲突解决完成以后再次执行1跟2的操作

    git拉取代码

    git pull origin 远程分支名

    git推送代码

    将代码推至远程
    git push origin master或者远程分支名

    git删除文件

    先将文件拉至本地,然后使用以下命令
    git rm -r --cached 你的文件名 例如: git rm -r --cached layer_utils
    删除之后需要请求提交
    git commit -m "remove folder and file list"
    最后使用push推送即可
    git push

  • 相关阅读:
    LeetCode 1245. Tree Diameter
    LeetCode 1152. Analyze User Website Visit Pattern
    LeetCode 1223. Dice Roll Simulation
    LeetCode 912. Sort an Array
    LeetCode 993. Cousins in Binary Tree
    LeetCode 1047. Remove All Adjacent Duplicates In String
    LeetCode 390. Elimination Game
    LeetCode 1209. Remove All Adjacent Duplicates in String II
    LeetCode 797. All Paths From Source to Target
    LeetCode 1029. Two City Scheduling
  • 原文地址:https://www.cnblogs.com/cokefentas/p/14727592.html
Copyright © 2011-2022 走看看