Skip to content

How to push as different user in github

  • by
  • Remove all existing keys
  • Generate ssh key for the current user which wants to commit to github
  • add the ssh key for new user
  • Initialise the new Repository 
  • Add the remote url ( here note that we are not using https url)
  • Add user name and email to git config
  • Commit and push to git

//check and delete existing keys
ssh-add -l
ssh-add -d

//add new key
ssh-add new_ssh_rsa_key

git init
git remote add origin git@github.com:git.user.name/ansible-utilities.git
git config --list
git config user.name  "User name"
git config user.email  "User email"

//Now push
git add .
git commit -m "Initial commit"
git push -u origin master

Leave a Reply

Your email address will not be published. Required fields are marked *