Before pushing to a remote server, you must first create a SSH public and private key pair. By using SSH, you will be able to securely authenticate to the server that you are who you say you are. Creating the key pair is a simple process. Begin by running the puttygen.exe program downloaded earlier. Next, click the Generate button to generate the keys. After processing for a few seconds, click the Save private key button to save your new private key. Copy the public key to the clipboard in preparation for the next step. I would recommend not clicking the Save public key button because the saved file is in a non-standard format; trying to use it with other software might be problematic.
Now that the keys are generated, the remote servers need to know about it. If you would like to use github to host your code, just go to your account page and paste in the public key.
Now github has our public key, but we do not yet have github's. To remedy this, launch putty.exe, connect to github.com, and click Yes to accept github's public key. You can safely close the login window that opens up after accepting the key.
We need our private key to be loaded up to use with our public key, so launch pageant.exe. This program will create an icon in your system tray. Double clicking on the icon will open up a window into which the private key can be added. Once the private key is added, the agent will sit in the background and provide authentication when needed.
Now that our client and server can authenticate each other, it is time to push! Remote → Push will open up the push dialog. Typing in the commit address for the project and clicking Push will send the changes on their way.
Of course, typing in the remote url would become quite annoying if we had to do it with every push. Instead, git allows us to alias the long urls using remotes. Git gui currently does not have a way to add a remote, so the command line must be used. Right click on the repository folder and choose Git Bash Here. In the prompt, enter the following command:
git remote add github email@example.com:nathanj/example.git
Note: After adding a remote, close and reopen git gui for it to recognize the new remote.
Now the remote github is aliased to the url firstname.lastname@example.org:nathanj/example.git. When viewing the push dialog in git gui, a convenient drop down list of remotes is shown.
|« Viewing History||Index||Pulling from a Remote Server »|