git命令详解

#首先进入到一个目录中。这个目录专门为gitlab使用。
cd /data/gitlab

#登录git仓库
git config --global user.name "用户名" # 设置用户名
git config --global user.email "用户邮箱"   #设置邮箱
git config --global user.name   # 查看用户名是否配置成功
git config --global user.email   # 查看邮箱是否配置


#现在可以将该仓库的clone从远程复制到您的本地:
git clone https://github.com/username/repository.git

#进入该目录并创建/编辑文件:
cd repository/
vim example_file.txt  #使用nano编辑器可以新建文本文件并进入编辑模式


#添加想要保存的更改:
git add example_file.txt

#提交变更:
git commit -m "Add example_file.txt"

#将变更推送到远程仓库:
git push origin master

posted @ 2023-06-12 11:04  安生丶  阅读(20)  评论(0)    收藏  举报