This guide assumes knowledge of various topics. Sorry.
Now assuming your new identity, iodine-swizzle
or generate your own with a passphrase
Assuming you already have a functional ~/.ssh/config
that looks something like
Host *
IdentityFile ~/.ssh/id_ed25519
User firstname
Host myserver
HostName myserver.example.com
prepend fake host overrides for your new identity
Host iodine-swizzle-github.com
HostName github.com
User git
IdentityFile ~/.ssh/iodine-swizzle
CheckHostIP no
Host gist.iodine-swizzle-github.com
HostName gist.github.com
User git
IdentityFile ~/.ssh/iodine-swizzle
CheckHostIP no
This adds the fake domains only for git ssh cloning. When cloning iodine-swizzle/stash
your fork of stashapp/stash
, copy the SSH address.
Replace github.com
with iodine-swizzle-github.com
to make [email protected]:iodine-swizzle/stash.git
Cloning from this URL will use your key for iodine-swizzle
instead of firstname
.
When committing under another account, it is important to change your git config to not reveal your identity. You can check all your settings with git config --list
.
Notable changes include
- user.email
- user.name
- user.signingkey
- commit.gpgsign
Unless you already have another email account configured, you'll likely want to go with the github noreply email. This follow the format [email protected]
For iodine-swizzle:
git config user.name Iodine Swizzle
git config user.email [email protected]
git config commit.gpgsign false
Changing commit.gpgsign
to false will prevent the usage of user.signingkey
.
After making a commit, make sure to verify that your new identity is in use - this can be confirmed with git log
.
If you have repositories segregated by folder, you can set overrides per file StackOverflow
~/.gitconfig (global)
[includeIf "gitdir:~/stash-projects/"]
path = ~/stash-projects/gitconfig
~/stash-projects/gitconfig
[user]
name = Iodine Swizzle
email = [email protected]
[commit]
gpgsign = false
If you committed but didn't push using the right identity, assume the correct one and then continue with your fix
git commit --amend --author="Author Name <[email protected]>" --no-edit
In our case,
git commit --amend --author="Iodine Swizzle <[email protected]>" --no-edit
If you want to correct this for all commits in a repository, Github outlines some steps for rewriting history as well as a StackOverflow Question that addresses this.
While local commits can be set-and-forget, the day-to-day with browsers and github.com can be dangerous since issues and comments might require intervention to delete
In order to prevent that, you can block access to certain sites in uBlock Origin
||github.com/stashapp^$document
The aforementioned rule blocks visiting any site that starts with github.com/stashapp/
. This would include stashapp/stash
and stashapp/CommunityScripts
. A similar rule can also be extended to other resources and sites. Being aware of what you are doing and under which identity you are working under is always important, nonetheless.