一、查看本地仓库状态
1.查看本地仓库状态
[root@k8s-master rege_git]# git log --oneline
21b8da9 (HEAD -> master, tag: V1.0, origin/master) 7.0-master hebing file xiaowu.txt
971127e 6.0-mster create a xiaowu.txt && xiaowu 6666
8f95061 (origin/xiaowu, xiaowu) 5.0-xiaowu create a xiaowu.txt
6a28554 4.0-lisi crate file lisi.txt
2d7bee4 2.0 create a stash.txt
ebc7eb6 1.0-create the file
2.查看本地工作区状态
[root@k8s-master rege_git]# git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
二、Git 全局设置
root@k8s gitlab]# useradd zhangsan
[root@k8s gitlab]# passwd zhangsan
Changing password for user zhangsan.
New password:
BAD PASSWORD: The password fails the dictionary check - it is too simplistic/systematic
Retype new password:
passwd: all authentication tokens updated successfully.
[root@k8s gitlab]# su - zhangsan
三、无本地仓库和本地代码时
mkdir test
cd test
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@gitee.com:zhangsan/test.git
git push -u origin "master"
四、已有本地git仓库时
cd existing_git_repo # 进入本地git仓库
git remote add origin git@gitee.com:zhangsan/test.git # 连接到远程仓库
git push -u origin "master" #上传主分支代码
git push -u origin --all #上传全部代码