We have a need to retrieve all metadata and apex classes from a salesforce org and push to a git hub repository hosted on bitbucket using ant. I have used the ant migration tool which helps to retrieve all metadata and apex from the sandbox. I am struggling to create an ant task which would retrieve files from a github repository and commit to it. Do you guys have sample ant build files which can retrieve from github, push, commit and where do we store the login information for github? Thanks Buyan

  • 2
    Is there any specific reason you aren't doing this using a GUI like SourceTree? Just curious. Feb 24, 2016 at 2:19
  • I need an automated way to create ant script so that i can build continous integration in our environment. Feb 24, 2016 at 3:32

1 Answer 1


Setup an SSH key to avoid storing the password, then use the sshexec task:

<target name="pull" description="Git pull">
  <sshexec host="${host}"
         command="git pull"/>


You must log in to answer this question.

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