OWASP O2 Platform Blog

O2 Script: adding the SSH Key to GitHub

Once we had TortoiseGIT  installed and used PuttyGen to create the SSH key we now need to add the SSH Key to the GitHub website, which is done by automating the browser:

        public static GitHub_CustomO2 add_SSH_PublicKey(this GitHub_CustomO2 gitHub)
        {       
            var ie = gitHub.IE;
            var keyPath = "What is the path to the public key to use?".askUser();
            if (keyPath.fileExists().isFalse())
            {
                "no key file provided".error();
            }
            else
            {
                var title = System.IO.Path.GetFileNameWithoutExtension(keyPath);
                var key = keyPath.fileContents();
                gitHub.homePage();
                gitHub.accountSettings();
                ie.link("SSH Public Keys").click();
                ie.link("Add another public key").click();    
                ie.field("public_key[title]").value(title);
                ie.field("public_key[key]").value(key);
                ie.button("<SPAN>Add key</SPAN>").click();    
            }
            return gitHub;
        }

March 18, 2011 - Posted by | Interoperability

1 Comment »

  1. […] installing  TortoiseGIT ,  using PuttyGen to create the SSH key and adding the SSH Key to GitHub the final step in this series is to create GIT Clone locally (this is how we check out code using […]

    Pingback by O2 Script: Creating a Git Clone using TortoiseGIT « O2Platform.com for Developers | March 18, 2011 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: