首页 > 其他分享 >git常用命令

git常用命令

时间:2022-10-24 20:55:51浏览次数:79  
标签:origin git gitee master ssh 常用命令 com

1、初始化仓库

1.1、Git 全局设置

git config --global user.name "wanghx"
git config --global user.email "[email protected]"

1.2、创建 git 仓库

mkdir TjHisNet6Api
cd TjHisNet6Api
git init 
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/his7/tj-his-net6-api.git
                      
git push -u origin "master"

1.3、已有仓库

cd existing_git_repo
git remote add origin https://gitee.com/his7/tj-his-net6-api.git
git push -u origin "master"

1.4、常用命令

# 添加当前目录的所有文件到暂存区
$ git add .

# 显示有变更的文件
$ git status

# 提交暂存区到仓库区
$ git commit -m "项目初始化"

# 显示当前分支的版本历史
$ git log

# 提交指定tag
$ git push

# 拉取
git pull --rebase origin master

1.5、常用命令托管到码云上

  • 注册并激活码云账号( 注册页面地址:https://gitee.com/signup

  • 生成并配置 SSH 公钥,在C:\Users\Administrator.ssh(没有的话,用ssh-keygen -t ed25519 -C "[email protected]" 三次回车生成)

  • ssh -t [email protected] 监测公钥是否配置成功

    Administrator@wanghx MINGW64 /d/vsdemo/vs2022/uni-app/uni-app-shop (master)
    $ ssh -t [email protected]
    The authenticity of host 'gitee.com (212.64.63.215)' can't be established.
    ED25519 key fingerprint is SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88.
    This key is not known by any other names
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added 'gitee.com' (ED25519) to the list of known hosts.
    Hi wanghx! You've successfully authenticated, but GITEE.COM does not provide shell access.
    Connection to gitee.com closed.
    
    Administrator@wanghx MINGW64 /d/vsdemo/vs2022/uni-app/uni-app-shop (master)
    
    
  • 创建空白的码云仓库,切换为ssh方式,执行以下两个语句,将源码推送到仓库

    git remote add origin [email protected]:his7/uni-app-shop.git
    git push -u origin "master"
    

标签:origin,git,gitee,master,ssh,常用命令,com
From: https://www.cnblogs.com/his365/p/16822753.html

相关文章

  • Linux 常用命令汇集
      查找目录文件  一般常用ll即可      注意在linux中用IPaddr 查看自己的网络ip   pwd显示目前所在路径   touch创建文件   ......
  • git rebase
    首先通过简单的提交节点图解感受一下rebase在干什么?提交节点图解两个分支master和feature,其中feature是在提交点B处从master上拉出的分支,master上有一个新提交M,featu......
  • Git常用命令总结
    1、(先进入项目文件夹)通过命令gitinit把这个目录变成git可以管理的仓库gitinit2、把文件添加到版本库中,使用命令gitadd.添加到暂存区里面去,不要忘记后面的小数点“.”......
  • Ubuntu 安装以及常用命令
    下载系统镜像文件到Ubuntu官网下载对应想安装的.iso系统镜像文件,以下ubuntu-20.04.4-desktop-amd64.iso为例下载地址:DownloadUbuntuDesktop|Download|Ubuntuapt命......
  • git hooks & ESLint All In One
    githooks&ESLintAllInOnegithookshttps://git-scm.com/book/en/v2/Customizing-Git-Git-Hookshttps://git-scm.com/docs/githooksESLinthuskyGithook......
  • 【Linux】3.常用命令
    1.关机&重启命令shutdown-hnow立刻进行关机shutdown-h11分钟后关机shutdown-r now立刻重新启动计算机halt关机reboot重启计算机sync......
  • Jenkins把GitHub项目做成Docker镜像
    欢迎访问我的GitHub这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos本篇概览本文是《Jenkins流水线(pipeline)实战》系列的第三篇,......
  • git无法提交的问题
    因为以前的公司用git还挺溜的,但是新公司并不用git所以也想把这个公司的git捣鼓一下,无奈本人也是个git小白在提交的时候出现了如上图的超级多文件的eslint语法报错,需要更......
  • 基于git和markdown的个人笔记
    吹一波Onenote,用了很多年了,体验是最好的。但是他不支持Linux,这个非常难受。需求全平台通用,win/mac/linux,我会在这三种平台下写笔记。手机端很少用,甚至查看都很少用。支......
  • Gitlab 中,将 master 分支改名为 main
    背景吵吵闹闹了很久的master-slave机制也过去了很久,国内的反向一直不太强烈。不过今天有研发部的同事反馈说,他们项目组不再允许使用master分支了,原因是【项目规定】......