Git如何合并并删除本地以及远程误创建并提交的master分支到Git默认的main分支?

Git如何合并并删除本地以及远程误创建并提交的master分支到Git默认的main分支?

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

事件回顾

  • 由于本人在本地创建了一个项目,将其推送到Git远程仓库后,发现本地的是master远程的是main,这就造成了默认的主分支不一致,故而有了这个需求

涎涎原创...大约 8 分钟GitGit
Git常用命令

Git常用命令

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

以下是一些常用的 Git 命令:

  1. 初始化一个新的 Git 仓库:
git init

涎涎原创...大约 1 分钟GitGit
Git报错Connection_reset_by_xxx_port_22

Git报错Connection_reset_by_xxx_port_22

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

场景复现

  • 如下所示
E:\Google\vuepress-theme-hope>git push github master
Connection reset by 20.205.243.166 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

涎涎原创...大约 2 分钟GitGit
Git报错fatal_detected_dubious_ownership_in_repository如何解决

Git报错fatal_detected_dubious_ownership_in_repository如何解决

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

报错信息

Administrator@DESKTOP-DFD9CE5 MINGW64 /d/alibaba/studyLog
$ git status

fatal: detected dubious ownership in repository at 'D:/alibaba/studyLog'
'D:/alibaba/studyLog' is owned by:
        'S-1-5-21-1768174577-13754125-2598047118-1001'
but the current user is:
        'S-1-5-21-2607242180-1233388006-380827990-500'
To add an exception for this directory, call:

        git config --global --add safe.directory D:/alibaba/studyLog


涎涎原创...大约 1 分钟GitGit
Git-GithubAction实现提交代码至私有库自动打包编译提交部署至公开库

Git-GithubAction实现提交代码至私有库自动打包编译提交部署至公开库?

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

需求

  1. 我有这样一个需求,如果我能够通过Git提交代码它能帮我自动打包部署至Github服务器那我不就会很省事
  • 当然很幸运github action提供了这样一个功能

涎涎原创...大约 4 分钟GitGit
Git如何解决提交到Github时老是要输入用户名和密码的问题?

16-Git如何解决提交到Github时老是要输入用户名和密码的问题?.md

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

bug复现

  • 如下图所示,Git提交github时老是让输入用户名密码

涎涎原创...大约 1 分钟GitGit
Git-如何将本地项目上传到Gitee或Github?

14-Git-如何将本地项目上传到Gitee或Github?.md

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

需求背景

如果我们在本地完成了一个 项目 那么我们想将其远程传入Github 或者 Gitee 那么应该如何操作呢?


涎涎原创...大约 2 分钟GitGit
Git提交时报错Logon failed use ctrl c to cancel basic credential prompt.

13-Git提交时报错Logon failed, use ctrl+c to cancel basic credential prompt..md

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

报错

  • 报错信息如下:

Logon failed, use ctrl+c to cancel basic credential prompt. remote: Support for password authentication was removed on August 13, 2021. remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication. fatal: Authentication failed for 'https://github.com/javaobjects/studyLog.git/'


涎涎原创...大约 1 分钟GitGit
2
3