0

I've followed the steps from here to create another git user because I want to set up multiple contributors to learn about git. Below is what I did

  1. create 2nd SSH key
  2. create 2nd github account and add SSH key
  3. ssh-add ~/.ssh/second_rsa
  4. in ~/.ssh/config
    Host stackjlei.github.com HostName github.com IdentityFile ~/.ssh/second_rsa

  5. I git cloned a repo that I was original author of with git clone [email protected]/Jacky-Lei/banana-app.git but it says repo doesn't exist so I just git cloned it like normal

  6. I made changes, added and committed. And then git config --local user.email "[email protected]" and git config --local user.name "stackjlei"

  7. I pushed but the repo still shows me as my original contributor (jacky-lei) account rather than my second account (stackjlei). How do I fix this?

4
  • You need to put the different host names in the repositories settings for the remotes (or add git remote add). You can even modify the .git/config file by hand to change the URLs. I am however not sure if it will work (in your case I guess using ssh://git@... should work for clone). Might be easier to not use key based auth but https passwords. Commented Nov 1, 2016 at 2:03
  • what else do I need to change the URLs? or how do I use https passwords? Commented Nov 1, 2016 at 2:07
  • i fixed it by changing my local name & email before i made any changes and commits rather than changing it right before pushing Commented Nov 1, 2016 at 2:17
  • This (changes to user.email/name before commit) will show different authors but still use the same commiter account. But I guess for playing around that is enough. Commented Nov 5, 2016 at 18:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.