码迷,mamicode.com
首页 > Web开发 > 详细

git安装,以及远程上传到gitee,(环境是wsl2, Ubuntu 20.04 LTS)

时间:2020-07-12 01:09:19      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:意义   lis   ubunt   shel   保存   wan   一个   print   仓库   

git安装

1. 检查apt包是否最新

$sudo apt-get update -y

2. 安装git

$sudo apt install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version (1:2.25.1-1ubuntu3).
git set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 94 not upgraded.

$git --version
git version 2.25.1

3. 配置git

// 配置名称与邮箱
$git config --global user.name "jarry_hum"
$git config --global user.email "g15888660315@gmail.com"

// 查看.gitconfig 来验证配置
$git config --list
user.name=jarry_hum
user.email=g15888660315@gmail.com

4. 创建过程ssh到gitee的公钥

$ssh-keygen -C ‘g15888660315@gmail.com‘ -t rsa

5. 复制到gitee

$cd ~/.ssh //进入用户目录下的.ssh
$vim id_rda.pub //把公钥复制出来,复制到https://gitee.com/profile中

6. 测试连接成功与否

$ssh -T git@gitee.com

The authenticity of host ‘gitee.com (212.64.62.174)‘ can‘t be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ‘gitee.com,212.64.62.174‘ (ECDSA) to the list of known hosts.

7. 上传步骤gitee上有详细,手动创建仓库后上传

$git init //初始化一个仓库
$touch README.md
$git add . //将所有文件添加到仓库,这个步骤想一个标记,一个文件只需要标记一次
$git commit -m "描述" //真正意义上的上传,保存到本地完成
//保存到远端,github上同理
$git remote add origin https://gitee.com/jarryhum/firsttest.git //设置一个远端地址
$git push -u origin master //push一下就上传好了,注意首次需要验证账号密码

git安装,以及远程上传到gitee,(环境是wsl2, Ubuntu 20.04 LTS)

标签:意义   lis   ubunt   shel   保存   wan   一个   print   仓库   

原文地址:https://www.cnblogs.com/jarryHu/p/13286185.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!