17 Jan

How To Use Git On Windows Via Putty / Pageant

Oliver Krautscheid Oct 19, 2015
0 777

Git is a common versioning tool. For a long time I preferred SVN on Windows, but git fully supports Windows SSH connections via putty/pageant. Here’s a quick introduction.

Git On Windows

Before Git and Pageant will work nicely together, you need to add a variable to your environment. You can do this using the following command:

set GIT_SSH=C:\Putty\plink.exe

On Your Local Windows Machine: Initialize Repo & Add Origin

Run the following commands to initialize a git repository and define a remote origin that we can push to whenever we want. Yes, you can do it the other way around using pulling from the local machine to the remote machine.

git init
git remote add origin ssh://root@IP:PORT/home/path/root/

Let’s take a quick look at the lines. Git init initializes the repo, then we define the origin using the ssh:// syntax. Don’t forget the port if you changed the SSH port! Followed by the path your git repository on the remote machine.

On Your Remote Machine: Initialize, Add And Commit

On the remote machine, we do it in a similar way. First we initialize a repo (doesn’t matter whether you have already files there, you can turn an existing site into a fully git-compatible repo)

git init
git add .
git commit -m 'message'

Using the “add .” command we add the entire content of the directory. However, it may be more practical to only add certain folders e.g. wp-content like this:

git add wp-content

Finally we commit the whole thing and add a message.

Final Step: On Local Pull From Origin (Master Branch)

Branching is a basic concept of git that allows you to create a sub repository for changes to your code so we don’t modify the core. You can also protect the core/master.

Alrighty, now lets pull a copy so we can work locally:

git pull origin master

Now it should download a proper copy. If it says “fatal could not read from remote repository” make sure you entered the path correctly. Most often this error occurs when you are entering an incorrect path or forgot to add your SSH key to your pageant instance.


This is a basic, rudimentary rundown that should help you getting started with Git on Windows using Putty.

Here are some additional resources I found useful:

About Us

Webmaster .Net is your all-in-one resource for blogging tips, system administration guides, industry news and a growing community of webmasters.

Can't find something or want to tip us?Contact@webmaster.net

Bulls and Bears

Leave a Comment

Your email address will not be published.

Webmaster Tutorials, Wordpress
0 shares1227 views

WordPress SQL Query: Select And Delete Posts Between Two Dates

Oliver Krautscheid - Apr 08, 2017

If you are wondering how to delete posts for a certain date, you will need to know how Wordpress stores…

Advertising and Ad Networks, Copywriting
0 shares924 views

15 Tips For Increasing Facebook Ads CTR – Full Guide [2017 Update]

Cam Connor - Mar 30, 2017

In this article, we'll talk a lot about how you can write quality text ads on Facebook Ads to get…

Webmaster Tutorials
0 shares1616 views

10 Steps To Configure Nginx For WordPress, Drop Varnish And Cut Your CPU Load By 50%

Oliver Krautscheid - Oct 10, 2016

Are you using Varnish on your Wordpress blog? Possibly the Varnish script by Unixy? Great! Get rid off it. Here's…

Follow Us And get latest news

© 2016 Webmaster.Net - Property of Peakstone Media Ltd. - All rights reserved. | Privacy Policy | DMCA | Contact Us | Advertise