一、git的本地初始化操作
1.配置本地git相关信息
代码语言:c 复制[root@192 k8s]# git config --global user.name "wangming"
[root@192 k8s]# git config --global user.email "123456@qq.com"
[root@192 k8s]# git config --global color.ui true
[root@192 k8s]#
2.查看git配置信息
代码语言:c 复制[root@192 k8s]# cat ~/.gitconfig
[user]
name = wangming
email = 123456@qq.com
[color]
ui = true
2.创建本地仓库
1.创建工作区
代码语言:c 复制[root@192 k8s]# git init .
Initialized empty Git repository in /git/k8s/.git/
[root@192 k8s]# ls -a
. .. data .git
2.将项目文件保存在暂存区
代码语言:c 复制git add .
3.将暂存区文件保存在本地仓库
代码语言:c 复制 git commit -m "1.0 master-wangming create item for k8s's yaml "
二、连接到远程仓库
1.连接远程仓库
代码语言:c 复制git remote add origin https://gitee.com/sadmin/kubernetes-yaml.git
2.查看连接状态
代码语言:c 复制[root@192 data]# git remote -v
origin https://gitee.com/sadmin/kubernetes-yaml.git (fetch)
origin https://gitee.com/sadmin/kubernetes-yaml.git (push)
三、上传到远程gitee仓库
代码语言:c 复制[root@192 data]# git push -u origin master
Username for 'https://gitee.com': admin
Password for 'https://admin@gitee.com':
Counting objects: 822, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (810/810), done.
Writing objects: 100% (821/821), 108.68 MiB | 3.55 MiB/s, done.
Total 821 (delta 609), reused 0 (delta 0)
remote: Resolving deltas: 100% (609/609), completed with 1 local object.
remote: Powered by GITEE.COM [GNK-6.3]
To https://gitee.com/sadmin/kubernetes-yaml.git
ffc584b..28dd1ea master -> master
四、查看gitte上代码
我正在参与2023腾讯技术创作特训营第三期有奖征文,组队打卡瓜分大奖!