The question is clear:

How do I perform Xcode's commands for git pull and git push via terminal?


I've set up multiple git accounts and ssh (Reference). Someone told me the reason why one of those git commands (from XCode or Terminal) doesn't work is because of different ssh policies. Xcode uses open SSH, while Terminal uses normal ssh (I'm not really sure about that). Therefore the ssh setup is different in Terminal and Xcode.

Since the remote origin URL should be the same, I'd like to know how to perform those commands in Terminal?

1 Answer 1


After some researches, I've just found an alternative solution for my problem, though it does not exactly answer what I asked.



  1. Create a file, name it something like: git02
  2. Open and add write this:


echo $1;
ssh-agent bash -c "ssh-add ~/.ssh/id_rsa2; $1"
  1. open terminal in the same folder, type $ chmod +x git02
  2. Copy this file to /usr/local/bin
  3. Execute desired command using something like this: $ git02 'git pull'

Work perfect for me now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .