Git is a very common and versatile version control system (VCS) for tracking changes in project files and coordinating work on those files among the multiple developers or teams.
Bitbucket is a web-based version control repository hosting service from Atlassian. The Bitbucket offers collaboration on code with inline comments and pull requests, which have made it more popular.
Here, we will see the steps to setup Bitbucket repository and git client on Windows platform. Also one can find the troubleshoot steps pertaining to Windows OS.
Step 1: Start with Bitbucket signup process in any web browser.
Open http://bitbucket.org Sign up using email id and password
Step 2: After validating registered email id you all set with the first bit bucket step.
Now create repository or Import existing Repository into bit bucket account.
Step 3: Setting up SSH key to avoid username and password
To access remote repository you need to connect using git client on windows.
Install git bash client for windows from here, http://git-scm.com/dowloads
Create new folder in your drive write click and select git-bash. It will open new linux like command prompt $
To generate SSH key
In git bash window type
Enter SSH file name
It will generate private and public keys with filename &filename.pub, where .pub is your public key
Step 4: Copy SSH key in bit bucket Account or Repository settings.
Goto .ssh folder usually in windows the path of ssh key is users/<username>/.ssh
Now open vim in git bash window or notepad and type .pub file path, which will open file content, now copy file content into the following places.
- Place 1: Select Repository > Setting > Access key > Add key
Copy key text and create new label. This will allow Read-Only git access.
- Place 2: Go to bit bucket settings and then at the bottom select SSH key now add key content into the box and same create new label.
Note: If you receive the error on save then the key is already being used by them. Remove the key form the place 1 or generate new by following previous steps.
Adding SSH key to the ssh-agent
Now you all set with generating ssh key and accessing bitbucket repository or changing the files without using username and the password.
To start ssh client open Git-bash and type
- $ eval ‘ssh-agent -s’
- Add key the SSH Agent
$ ssh-add ~.ssh/<key>.pub
- Test SSH authentication
$ssh -T email@example.com
Once setup is done, start git bash in windows on project folder and run git commands.
To know more or learn git command usage, one can refer following link.