如何修改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_EMAIL
CORRECT_NAME
CORRECT_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 是与他人协同工 ...
随机推荐
- 3676: [Apio2014]回文串
3676: [Apio2014]回文串 Time Limit: 20 Sec Memory Limit: 128 MB Submit: 1740 Solved: 744 [Submit][Status ...
- doppia代码支持
stixels_t在stixel.hpp里,存储class stixel的vector
- ng-repeat 指令(带有对象)
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- android(eclipse)编程中常见的java问题总结(四)
0:java流: 流是具有方向的 在文件操作中java流分为字节流:Filereader和Filewriter字符流:FileOutputStream,FileInputSream 例如在 ...
- linux上安装Python3和django流程详解
1.安装python3 1.1 安装相关依赖库(工具包) --->很重要 yum install gcc patch libffi-devel python-devel zlib-devel ...
- jdk下载安装
1.下载地址:https://www.oracle.com 注册,登陆,选择版本下载(注意,下载时提示you must accept the license agreement before down ...
- spring mvc 数据绑定入门
1:基本数据类型key 是必传的并且必须类型一致 // http://localhost:8080/bind/baseType.do?xage=10 @RequestMapping(value = & ...
- Xadmin使用二
1:修改site-title和site-footer,增加菜单折叠效果 在adminx.py中增加下面代码: class GlobalSetting(object): # 设置Title site_t ...
- org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field xxx exceeds its maximum permitted size of 1048576 bytes.
springboot 通过MultipartFile接受前端传过来的文件时是有文件大小限制的(springboot内置tomact的的文件传输默认为1MB),我们可以通过配置改变它的大小限制 首先在启 ...
- git stash应用
今天在看一个bug,之前一个分支的版本是正常的,在新的分支上上加了很多日志没找到原因,希望回溯到之前的版本,确定下从哪个提交引入的问题,但是还不想把现在的修改提交,也不希望在Git上看到当前修改的版本 ...