如何修改Github上提交的错误用户地址和姓名
Changing author info
To change the name and/or email address recorded in existing commits, you must rewrite the entire history of your Git repository.
Warning: This action is destructive to your repository's history. If you're collaborating on a repository with others, it's considered bad practice to rewrite published history. You should only do this in an emergency.
Changing the Git history of your repository using a script
We've created a script that will change any commits that previously had the old email address in its author or committer fields to use the correct name and email address.
Note: Running this script rewrites history for all repository collaborators. After completing these steps, any person with forks or clones must fetch the rewritten history and rebase any local changes into the rewritten history.
Before running this script, you'll need:
- The old email address that appears in the author/committer fields that you want to change
The correct name and email address that you would like such commits to be attributed to
Open Terminal (for Mac users) or the command prompt (for Windows and Linux users).
Create a fresh, bare clone of your repository:
git clone --bare https://github.com/user/repo.git
cd repo.gitCopy and paste the script, replacing the following variables based on the information you gathered:
OLD_EMAILCORRECT_NAMECORRECT_EMAIL#!/bin/sh git filter-branch --env-filter ' OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
- Press Enter to run the script.
- Review the new Git history for errors.
Push the corrected history to GitHub:
git push --force --tags origin 'refs/heads/*'
Clean up the temporary clone:
cd ..
rm -rf repo.git
如何修改Github上提交的错误用户地址和姓名的更多相关文章
- 修改Github上提交日志
bash: git rebase -i HEAD~5:假定你要修改的日志位于当前版本(HEAD)的前4次提交中. vi: pick -> reword:在自动打开的vi编辑器中,上下选择你要修改 ...
- Git安装配置和提交本地代码至Github,修改GitHub上显示的项目语言
1. 下载安装git Windows版Git下载地址: https://gitforwindows.org/ 安装没有特别要求可以一路Next即可,安装完成后可以看到: 2. 创建本地代码仓库 打开G ...
- 如何在github上提交pr
如何在github上提交pr 1.fork开源的代码到自己的远程仓库 2.clone自己的仓库到本地电脑 3.与源代码的github仓库建立新的连接 git remote add upstream h ...
- 命令行将本地代码上传到github及修改github上代码
第一步:建立git仓库 cd到你的本地项目根目录下,(这是我的细目目录) 执行git命令 git init 第二步:将项目的所有文件添加到仓库中 git add . 如果想添加某个特定的文件,只需把. ...
- 向github上提交自己的project
参考博客:https://blog.csdn.net/m0_37725003/article/details/80904824 step I: 创建自己的github账户(username:fourm ...
- 新手小白如何向GitHub上提交项目
首先你得注册一个自己的GitHub账号,注册网址:https://github.com/join 创建一个新的项目,填写项目名称,描述 创建完成之后,跳转到下面的页面,下面红框中的网址要记住,在后面上 ...
- 修改GitHub上项目语言显示的问题
问题 最近将自己写的博客放到github上了.由于使用了富文本编辑器.jQuery.Bootstrap等第三方插件,导致js.css等代码远远超过你自己写的代码. 于是也就成这样了 而且这里也显示Ja ...
- 修改GitHub上项目语言显示
问题 最近将自己以Scala为主语言写的博客放到github上了.由于使用了富文本编辑器.jQuery.Bootstrap等第三方插件,导致js.css等代码远远超过你自己写的代码. 于是也就成这样了 ...
- [转]修改github已提交的用户名和邮箱
改变作者信息 为改变已经存在的 commit 的用户名和/或邮箱地址,你必须重写你 Git repo 的整个历史. 警告:这种行为对你的 repo 的历史具有破坏性.如果你的 repo 是与他人协同工 ...
随机推荐
- 【转】Js中Prototype、__proto__、Constructor、Object、Function关系介绍
一 Prototype.__proto__与Object.Function关系介绍 Function.Object:Js自带的函数对象. prototype,每一个 ...
- 最短路算法——SPFA
用途: 单源最短路径,不可以处理含负权边的图但可以用来判断是否存在负权回路: 复杂度O(kE) [k <= 2, E 为边数]: 算法核心: Bellman-Ford 算法的优化,实质与前算法一 ...
- 【转】Mac本地生成SSH Key 的方法
1. 查看秘钥是否存在 打开终端查看是否已经存在SSH密钥:cd ~/.ssh 如果没有密钥则不会有此文件夹,有则备份删除, 也可以直接删除, 2.生成新的秘钥, 命令如下 $ssh-keygen ...
- jdbc连接各种数据库字符串
oracle driverClass:oracle.jdbc.driver.OracleDriver url:jdbc:oracle:thin:@127.0.0.1:1521:dbname mysql ...
- spring(二)-反射、动态代理
主要是对上一篇文章中涉及到的点做补充,欢迎指正! 1. java反射知识-Spring IOC 依赖注入 Java反射机制主要提供了以下功能: 在运行时判断任意一个对象所属的类:在运行时构造任意一个 ...
- RPAD()和LPAD()函数进行字符串的填充
RPAD()函数从右边对字符串使用指定的字符进行填充. 格式:RPAD(string,padded_length,[pad_string]) string 表示:被填充的字符串. padded_len ...
- Qt学习交流(广告)
最近全面学习QT与c++,希望同行能够指教,于是打算建个群QQ群:85439482,欢迎大家,本群主要专注于QT皮肤库积累,软件架构以及标准c++学习.
- GitHub的搭建,使用
Git是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作Linux内核代码的管理.在推出后,Git在其它项目中也取得了很大成功,尤其是在Ruby社区中.目前,包括Rubinius ...
- c c++面试c工程开发之宏定义和条件编译
多数c语言的初学者对c工程开发过程各个阶段的作用理解不到位,而这方面的的知识又是实际开发过程中经常用到的技能点,所以就成为面试考察中一个重要的考察方面.例如:头文件的作用.头文件的内容:链接的作用和意 ...
- 嗨翻C语言笔记(二)
~a a中所有位都取反 a & b a中的位 与 b中的位 (都为1则1,否则为0) a | b a中的位 或 b中的位 (只要对应位一个位1则为1) a ^ b a中的位 亦或 b中的位 & ...