我有一个本地git存储库,其中有一堆用我的真实姓名和个人电子邮件进行的提交。我想将这些推送到GitHub,但不使用我的个人详细信息。
我已经使用以下命令重写了每次提交的名称和电子邮件:
git filter-branch -f --env-filter \
"GIT_AUTHOR_NAME='github_username'; GIT_AUTHOR_EMAIL='github_username@users.noreply.github.com'; \
GIT_COMMITTER_NAME='github_username'; GIT_COMMITTER_EMAIL='github_username@users.noreply.github.com';" HEAD
在此之后执行git log
时,一切看起来都很好。我的个人电子邮件无处可寻。
然后我尝试使用以下方法对每次提交进行GPG签名:
git filter-branch --commit-filter 'git commit-tree -S "$@";' -- --all
但是在第一次提交时,出现以下错误:
Rewrite 1124486cba6a6f6432adb24f7c66833d860b191f (1/38) (1 seconds passed, remaining 37 predicted)
gpg: skipped "My Real Name <my_real_email@gmail.com>": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
could not write rewritten commit
它从哪里获得我的旧用户名和密码?
答案 0 :(得分:1)
最终发现罪魁祸首是void CHomeAwayMaintPage::InitDayStateArray(int iMonthCount,
LPMONTHDAYSTATE pDayState, COleDateTime datStart)
{
int iStartMonth, iLastMonth, iThisMonth, iMonth = 0;
COleDateTime datDay;
COleDateTimeSpan spnDay;
CString strDate;
SCHEDULE_DATA_S *psTalk = NULL;
S_JOURNAL_ITEM *psJournal = NULL; // AJT v11.2.0
if (pDayState != NULL)
{
memset(pDayState, 0, sizeof(MONTHDAYSTATE)*iMonthCount);
spnDay.SetDateTimeSpan(1,0,0,0);
datDay = datStart;
iStartMonth = datStart.GetMonth();
iThisMonth = iStartMonth;
iLastMonth = iThisMonth;
do
{
strDate.Format(_T("%d-%02d-%02d"),
datDay.GetYear(),
datDay.GetMonth(),
datDay.GetDay());
// try to get this entry from map
psTalk = NULL;
m_mapSPTalkDates.Lookup(strDate, (void*&)psTalk);
if (psTalk != NULL && psTalk->uTalkNumber != 1000)
BOLDDAY(pDayState[iMonth], datDay.GetDay());
// AJT v11.2.0
strDate = datDay.Format(_T("%Y-%m-%d"));
psJournal = NULL;
m_mapStrPtrJournalCalendar.Lookup(strDate, (void*&)psJournal);
if (psJournal != NULL)
BOLDDAY(pDayState[iMonth], datDay.GetDay());
datDay = datDay + spnDay;
iThisMonth = datDay.GetMonth();
if (iThisMonth != iLastMonth)
{
iLastMonth = iThisMonth;
iMonth++;
}
} while(iMonth < iMonthCount);
}
}
。将其更改为-- --all
可以正常工作。
HEAD