TheLocehiliosan / yadm

Yet Another Dotfiles Manager
https://yadm.io/
GNU General Public License v3.0
4.91k stars 176 forks source link

YADM pushes to Github using the wrong user credentials? #462

Closed BaconIsAVeg closed 11 months ago

BaconIsAVeg commented 11 months ago

I wanted to setup YADM with a new Github account, instead of using the same account I use for my work organization.

I've created a new ssh key and uploaded it to the new github account, setup my .ssh/config with the custom hostname:

Host github.com
  Hostname github.com
  User git
  IdentityFile ~/.ssh/id_rsa

Host github.com-personal
  Hostname github.com
  User git
  IdentityFile ~/.ssh/personal

I've also setup the yadm remote to use the new hostname:

yadm remote -v
origin  git@github.com-personal:BaconIsAVeg/dotfiles.git (fetch)
origin  git@github.com-personal:BaconIsAVeg/dotfiles.git (push)

However when I check the commit history on my repo, it shows that BaconIsAVeg authored the commits, but my other account committed them.

The ssh config is setup correctly, as when I ssh to github.com or github.com-personal, I see the appropriate username.

I've also populated the correct user/email in ~/.config/yadm/config.

yadm config -l --show-origin
file:/home/atlas/.config/yadm/config    user.email=<email>
file:/home/atlas/.config/yadm/config    user.name=BaconIsAVeg
file:/home/atlas/.config/yadm/config    github.user=BaconIsAVeg
file:/home/atlas/.config/yadm/config    branch.autosetuprebase=always
file:/home/atlas/.config/yadm/config    branch.autosetupmerge=true
file:/home/atlas/.config/yadm/config    rebase.autostash=true
file:/home/atlas/.config/yadm/config    diff.tool=mydiff
file:/home/atlas/.config/yadm/config    difftool.mydiff.cmd=colordiff -NuBbwi "$LOCAL" "$REMOTE"
file:/home/atlas/.config/yadm/config    push.default=current
file:/home/atlas/.config/yadm/config    color.diff=auto
file:/home/atlas/.config/yadm/config    color.status=auto
file:/home/atlas/.config/yadm/config    color.branch=auto
file:/home/atlas/.config/yadm/config    color.interactive=auto
file:/home/atlas/.config/yadm/config    color.ui=true
file:/home/atlas/.config/yadm/config    color.pager=true
file:/home/atlas/.config/yadm/config    color.sh=auto
BaconIsAVeg commented 11 months ago

Interestingly, if I move my ~/.gitconfig file, yadm responds with 'Author identity unknown'. So it's not using the ~/.config/yadm/config file at all.

BaconIsAVeg commented 11 months ago

Ok, I found the answer in the FAQ. Sorry!