Git备忘 2021-11-08

查看项目远程地址:
git remote -v

普通克隆方式:
git clone <远程仓库地址>

指定分支克隆
git clone -b <指定分支名> <远程仓库地址>

git 配置全局字符集编码
(防止中文commit信息乱码)
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
export LESSCHARSET=utf-8

git给本地文件上传到远程端:
git config --global user.name "xxname"
git config --global user.email "xxx@qq.com"

创建 git 仓库:
:新仓库
mkdir test
cd test
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/xxx/xxx.git
(ps:如果这里写错了,可以用命令查看设置了什么"git remote -v", 然后重新设置远程提交地址:"git remote set-url origin https://xx")
git push -u origin master

已有仓库?
cd existing_git_repo
git remote add origin https://gitee.com/xxx.git
git push -u origin master

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容