j_d
j_d

Reputation: 3082

How to change user identity when git pushing via ssh?

So I am trying to set up some automated git pushing/pulling on an EC2 instance. Doing this super simply via Node:

var add = require('child_process').execSync('git add {FILENAME})
var commit = require('child_process').execSync('git commit -m "{COMMIT_MESSAGE}"')

I created a new ssh key on my EC2 instance, adding it as a deploy key on the GitHub repo and allowed write access.

Everything is working perfectly, except the commit author is coming through as EC2 Default User. I would like it to be my own GitHub account, so that the commits appear on my profile, etc. How is this possible?

Upvotes: 1

Views: 1799

Answers (1)

VonC
VonC

Reputation: 1323553

The commit author has nothing to do with which ssh key is used to authenticate the push.

It has to do with the current Git config:

git config user.name
git config user.email

Make sure the values for those local settings are correct (local for the EC2 Git repo), and the next new commits will be with the right author.

Upvotes: 3

Related Questions