# 获取远程分支,并合并远程分支 ps:可以使用 git pull origin main 一步取代 git fetch origin main git merge origin/main
# 查看本地分支 git branch
# 本地分支是master,直切创建并切换到main分支 git checkout -b main
# 查看本地文件状态 git status
git add . git commit -m "init commit"
git push -u origin main:main
如果git客户端报错如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
INFO 171 files generated in 1.9 s INFO Deploying: git INFO Setting up Git deployment... Initialized empty Git repository in /home/gitlab-runner/builds/xTeKDtDV/0/xplorist/keep/.deploy_git/.git/ *** Please tell me who you are. Run git config --global user.email "[email protected]" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'gitlab-runner@iZ2vcevk40p3shxd80kkt7Z.(none)') FATAL { err: Error: Spawn failed at ChildProcess.<anonymous> (/home/gitlab-runner/builds/xTeKDtDV/0/xplorist/keep/node_modules/hexo-util/lib/spawn.js:51:21) at ChildProcess.emit (node:events:390:28) at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) { code: 128 } } Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
那就到切换到该目录下手动操作
1 2 3 4 5 6 7 8 9 10 11 12 13
cd /home/gitlab-runner/builds/xTeKDtDV/0/xplorist/keep/public/
Fetching changes with git depth set to 50... Reinitialized existing Git repository in /home/gitlab-runner/builds/xTeKDtDV/0/xplorist/keep/.git/ Checking out 73be115a as main... warning: failed to remove ".deploy_git/2020/12/16/GitLab\344\271\213CI_CD\351\205\215\347\275\256/index.html": Permission denied warning: failed to remove ".deploy_git/2020/12/18/\351\227\250\346\210\267\347\263\273\347\273\237\344\270\255\347\263\273\347\273\237\347\273\237\350\256\241Matomo\351\205\215\347\275\256/index.html": Permission denied