linux 创建git项目并提交到gitee(保姆式教程)

01、git安装与初始化设置

shell 复制代码
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ apt install 
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ git config --global user.name "用户名"
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ git config --global user.email 10086@qq.com

02、生成密钥并拷贝

生成密钥

shell 复制代码
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ ssh-keygen -t rsa -C "your email"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mhzzj/.ssh/id_rsa): 
Created directory '/home/mhzzj/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/mhzzj/.ssh/id_rsa
Your public key has been saved in /home/mhzzj/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:BenbzPgfLVOb9VGmWsaANDH7nLXKvF8XLfNEibbhHKg your email
The key's randomart image is:
+---[RSA 3072]----+
|        ..=.     |
|        .o =. . .|
|       .  +..=..+|
|        ...o+=+=o|
|        SE  ++Xo+|
|        o +o B O+|
|         .  O + =|
|          .  = ..|
|           .o..  |
+----[SHA256]-----+

拷贝密钥到gitee

shell 复制代码
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ cat /home/mhzzj/.ssh/id_rsa.pub #查看生成的密钥
ssh-rsa 
******

测试密钥是否生效

shell 复制代码
hzzj@mhzzj-virtual-machine:~/work/skynetStudy$ ssh -T git@gitee.com
The authenticity of host 'gitee.com (180.76.198.77)' 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,180.76.198.77' (ECDSA) to the list of known hosts.
Hi mhzzj(@mhz-zzj)! You've successfully authenticated, but GITEE.COM does not provide shell access.

03、创建项目并提交代码

创建项目

提交代码

shell 复制代码
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ git init
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ git add .
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ git commit -m "basic skynet"
# 注意,使用ssh提交,否则需要输入账号和密码 如果意见add https,可以使用git remote rm origin删除已有的原创连接
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ git remote add origin git@gitee.com:mhz-zzj/skynet-study.git 
mhzzj@mhzzj-virtual-machine:~/work/skynetStudy$ git push -u origin "master"
相关推荐
炫友呀3 小时前
Centos 更新/修改宝塔版本
linux·运维·centos
Cosmoshhhyyy3 小时前
mac环境下安装git并配置密钥等
git·macos
yuwei0214 小时前
git大全解
git
花小璇学linux7 小时前
imx6ull-驱动开发篇24——Linux 中断API函数
linux·驱动开发·嵌入式软件
林开落L7 小时前
库制作与原理(下)
linux·开发语言·centos·库制作与原理
wxy3198 小时前
嵌入式LINUX——————TCP并发服务器
java·linux·网络
Castamere8 小时前
配置 Linux 终端 (zsh)
linux
小林的技术分享8 小时前
版本控制系统-Git 学习 《progit》电子书学习记录 第一章 (仅隔个人学习记录用)
git
小韩博9 小时前
metasploit 框架安装更新遇到无法下载问题如何解决
linux·网络安全·公钥·下载失败
长臂人猿9 小时前
JVM常用工具:jstat、jmap、jstack
linux·运维·jvm