0% found this document useful (0 votes)
44 views1 page

TortoiseGit and BitBucket

The document provides step-by-step instructions for setting up Git and TortoiseGit on Windows to connect to Bitbucket. It outlines downloading and installing Git for Windows, configuring user information, generating SSH keys, and cloning a repository from Bitbucket to test the setup.

Uploaded by

Eric Fortier
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views1 page

TortoiseGit and BitBucket

The document provides step-by-step instructions for setting up Git and TortoiseGit on Windows to connect to Bitbucket. It outlines downloading and installing Git for Windows, configuring user information, generating SSH keys, and cloning a repository from Bitbucket to test the setup.

Uploaded by

Eric Fortier
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

blog of Guganeshan.

T pages:
about

blogroll
ben nadel's blog
September 29, 2013 johannes brodwall's blog
scott guthrie's blog
Setting up Git and TortoiseGit with Bitbucket, step by step scott hanselman's
Filed under: Featured Articles,Git — Tags: Bitbucket, Git, Git Bash, SSH, TortoiseGit, Tutorial — Guganeshan.T @ 1:48 am computerzen
the smart passive income
blog
I wanted a set of instructions for my colleagues and friends when they want to setup Git and TortoiseGit on Windows (connected to Bitbucket). There are some steps that I have to Google myself too every time, because I don’t
install Git & TortoiseGit everyday.
categ ories:
featured articles
git
Okay, so this post is going to be a bare-bones, step by step guide for me or anyone (No backgrounds, theories and other noise) nature
news
personal
Basics: photography
privacy and security
programming
Git – is a free and open source distributed version control system. science and technology
story
TortoiseGit – is a Git client (GUI interface). tips
tools
Bitbucket – is a web-based project hosting service (supports Git and Mercurial) troubleshooting

searc h:
Assumptions:
Search
You already have a Bitbucket account. If not, you can create one here.
I’m installing this on Windows 7 – 64bit. I assume you can adapt to minor differences in your flavor of Windows. archi ves:
september 2013
january 2012
Installing Git december 2011
august 2011
july 2010
1. Download the latest Git for Windows → http://git-scm.com/download/win february 2010
january 2010
december 2009
2. Start the installation and continue clicking “Next” until you come to the “Select Components” view (see below). may 2009
january 2009
december 2008
We only mark “Git Bash Here”, as shown in the image (This will add an entry in the right-click context menu of folders) → november 2008
october 2008
june 2008
may 2008

meta:
log in
rss
comments rss
valid xhtml
xfn
wp

3. Continue clicking “Next” without changing anything and finally click “Finish” to complete the setup. We have completed installing Git.

Configure Git settings

1. Click Start Menu and type “Git Bash” and press Enter to open a Git command-line window

2. Provide your name and email address to Git, so that it will label your commits properly.

For example, if you want your name to look like “John Doe” in your commits and your email address (registered with Bitbucket) is johndoe@doebrothers.com, you would enter the following two commands (press Enter after
each line) →

git config –global user.name “John Doe” git config –global user.email “johndoe@doebrothers.com”

This is how it would look in Git Bash →

Create SSH identity and copy public key to clipboard.

To make sure we don’t enter our username and password every time we push to or pull from the Bitbucket repository, we should use SSH (secure shell) to communicate with Bitbucket. Lets go ahead and create our SSH identity
to communicate with Bitbucket.

1. Click Start Menu and type “Git Bash” and press Enter to open the Git command line (if it is not already open)

2. Type the following command and press Enter →

ssh-keygen –t rsa –C “johndoe@doebrothers.com”

(Use your email address registered with Bitbucket)

You will be prompted to provide file location and to enter a passphrase twice. Keep pressing the Enter key to accept the default file locations and to skip providing a passphrase.

Now the key files are generated. Easiest way to copy the contents of the public key to the clipboard is to use the “clip” command as follows →

clip < ~/.ssh/id_rsa.pub

Once you press Enter, the contents will be in clipboard, ready to be pasted.

This is how it will look in Git Bash →

Add the copied public key to Bitbucket

1. Log into Bitbucket and click on your avatar (bottom left-hand corner). Click “Bitbucket settings”

2. Click on the “SSH keys” link under “Security” section of the settings and click on “Add Key” button on the right, to add a new key.

3. In the “Add SSH key” popup that comes up, paste the copied contents of the public key in the “Key” text box.

4. Provide a label for this key in the “Label” text box, to identify it (optional). For example it could be “Personal Laptop”.

5. Click on the “Add key” button to save and close the popup. Key with the “Personal Laptop” label (or any other name provided) should be listed like in the following image →

At this point we have everything ready to work with Git and Bitbucket… ONLY if you are someone who loves the command-line!

If you were one of those rare breeds, you wouldn’t even be here reading this guide. So let’s continue and see how we can install and setup TortoiseGit as our GUI interface for Git (there are many other excellent Git clients too, that
you can try, e.g.: SourceTree)

Installing TortoiseGit

1. Download the latest TortoiseGit here → http://code.google.com/p/tortoisegit/ (Make sure you select the right setup for your PC – 32bit or 64bit).

2. Start the installation and keep clicking “Next” until you come to the following view (Choose SSH client). Choose “OpenSSH, Git default SSH Client” here.

Note: If you don’t see the “Choose SSH Client” option during installation, don’t worry. This can happen if you are reinstalling TortoiseGit (The settings are left behind in a previous installation in the Registry).

If this happened to you, Click “Finish” and try the “Extra Step” provided blow. Then you can continue from “Let’s test our installation” topic.

3. Click “Finish” to complete the setup

Let’s test our installation

We need a valid Git repository in Bitbucket to test our installations and configurations.

Go to an existing repository or create a new repository (this can even be a repository to only test Git with Bitbucket, that you can delete immediately).

1. Click on the “Clone” button on top (next to the “Fork” button).

2. Select “SSH” from the drop-down.

3. You will see a text box to the right with all its text selected. “git clone” is a command and we don’t need that now. So, copy everything else.

This is how it would look in Bitbucket →

If you paste the copied text to a text editor like Notepad, it should look something like the following (Note that there’s no “git clone” command in it. If you accidentally copied that too, copy again WITHOUT it).

git@bitbucket.org:guganeshanthambiraja/sample-repository.git

Some parts will be different for you because you will have a different username and repository name. This is our clone URL.

4. Let’s “clone” the repository on the desktop (you can delete and try a different location later). Right-click on the Desktop and select “Git Clone…” from the context menu.

5. A window will popup. Paste the copied clone URL in the “URL” box and click Ok →

6. If this is the 1st ever time you are communicating with Bitbucket using SSH, you will see the following message (Git doesn’t know Bitbucket as a host yet) →

Just click “Yes” to remember bitbucket.org in future sessions.

If everything went on fine, you should see a blue success message at the bottom in TortoiseGit once the cloning is complete →

Commit a new file to your repository and Push to Bitbucket

Only when you could commit and push a file to Bitbucket without a problem, that we can confidently say our setup works.

Yeah, that’s “home-work” for you and I’m not going to list any steps here

Since the purpose of this article was to setup the necessary tools, “how to” work with these tools is beyond scope (Can be discussed in another article maybe).

EXTRA STEP, only if you didn’t get the “Choose SSH client” option

If you didn’t see the “Choose SSH Client” option during installation (which can happen if you are reinstalling TortoiseGit – the settings are left behind in a previous installation in the Registry). You can set this later in TortoiseGit
settings after installing TortoiseGit as described below →

1. Right-click on any folder and select: TortoiseGit → Settings, from the context menu.
2. Click on the “Network” node.
3. You will see the “SSH client:” option on the right.
4. Make sure it has only ssh.exe in it.
5. Click Ok.

Here’s a screenshot of the Network options in TortoiseGit settings →

Your feedback!

I want to keep this post as simple as possible for anybody to follow. If you found any areas where it is not clear, please let me know below in the comments, so that I can make sure its simple for everyone.

Adiós

Comments (102)

102 Comments »

1. so great

Comment by rafael — July 18, 2017 @ 7:06 am

2. Thank you very much!


Easy instruction. Bitbucket changed its interface again but otherwise quite easy to follow the steps.

Comment by Marie-Helene Lavoie — September 13, 2017 @ 2:38 am

3. Thank you so much!


I’ve spent so much time before I found this instruction.

Comment by Kai — October 30, 2017 @ 2:15 am

4. thanks, you saved my day

Comment by Noman — April 5, 2018 @ 9:06 am

5. Still Very helpful even up to this date! Thanks!

Comment by Noodles — July 2, 2018 @ 11:15 am

6. This is fantastic. Applies to Visual Studio online repos as well. I was using SourceTree and kept getting prompted to enter my VS credentials every time I did a push/pull/commit. I uninstalled and wanted to use TortoiseGIT (I know
TortoiseSVN pretty well so wanted to keep this similar). For VS, just use the same steps to add SSH key to VS online repo.

Comment by MSIGuru — April 3, 2019 @ 2:20 pm

7. Even up to this date, this is still so helpful! Upvote!


Thank you.

Comment by Noodles — April 25, 2019 @ 8:34 pm

8. Thank you. This worked.

Comment by Harikrishnan R — November 25, 2019 @ 11:05 pm

9. […] Setting up Git and TortoiseGit with Bitbucket, step by step […]

Pingback by Mengatur TortoiseGit dengan Bitbucket di Windows – Adha Mashur Sajiah — April 25, 2020 @ 4:29 am

10. […] http://guganeshan.com/blog/setting-up-git-and-tortoisegit-with-bitbucket-step-by-step.html […]

Pingback by Set up Git and TortoiseGit – X-RAY's Blog — April 29, 2020 @ 12:31 pm

11. These steps do not work in 10/22/2020

Comment by hoihoi8 — October 23, 2020 @ 2:38 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Name (required)

Mail (will not be published) (required)

Website

Submit Comment

Powered by WordPress

You might also like