Перейти к содержимому

Bitbucket sourcetree как пользоваться

  • автор:

Git, Github & Bitbucket

Verify that is is by opening a shell (command prompt on Windows) and enter the following:

The system might respond with something like this:

Github

Sign up for a github account:

Be sure to verify your email.

Bitbucket

Sign up for a github account:

Be sure to verify your email.

Install Sourcetree

And download and install the application for your platform.

On the very first screen — you will be asked to log in to Atlassian . Your bitbucket credentials should work here.

During installation you will be asked to link your sourcetree installation to github and to bitbucket

This are the first install screen you will see:

Here you will be asked to log in to an Atlassian account:

The credentials here should be the same as your bitbucket account details from the last step.

We would like to link our Sourcetree installation to both Bitbucket & Github:

Selecting each of the above will take you through an authorisation sequence with both services.

If all goes well, the Sourcetree home screen will launch:

To see if the both the bitbucket a github accounts are properly linked, select Tools->Options->Authentication :

This should show the both accounts linked as above. If not, you can press add and link them now (no need to reinstall).

Create new Repo on Github

Create a new repository:

This will create a new empty repo on github.

Note carefully the url of the repo — in the box above. Copy this to the clipboard now.

Create New Application

We now would like to start a new play application, which we will tie to a github repo.

First, create a new app by cloning a starter app:

Create New Project

Create a new play project using this command:

The shell should show something like this:

Rename Project

The default name of the project should be changed now. This will require the following procedure:

    Rename the folder play-template-1 . Call the folder todolist-versioned instead.

Use Sublime Text to edit this file: playlist/conf/application.conf . The first three lines contains the following:

Change play-template-1 above to todolist-versioned , and save the file:

Run the project —

and verify that the skeleton app is available:

Set Remote Repo

Your Sourcetree app currently looks like this:

Locate the todolist-versioned folder we just created, and drag and drop it onto SourceTree:

Select it in the navigation panel, and we have a more detailed view:

Select Repository->Settings — and you will get details of the current remote repo this repository is connected to:

Select Edit — and change URL / Path to the url you should have in the clipboard from step 3:

Press the Push button:

This will bring up this screen:

When you press Push on this panel, the application will be replicated to the repo in your account on github. This might take a minute or so.

You should be able to view it on github now:

Explore the various view — including the commits screen:

Exercises

To get fluent with this procedure, try the following:

Exercise 1: Github Practice

Create another new app — called demo-1 — using the procedure specified on Step 04.

Then, Following steps 05 and 06, attach the new project to a new repo on github.

Exercise 2: Bitbucket Practice

The procedure we carried out to bind a local repo to github can also be carried out to bind a repo to a bitbucket hosted repository. Create (another!) new project demo-2 — this time see if you can figure out how put it on bitbucket.

The main difference between github and bitbucket is that github repos are always public, whereas bitbucket can be either (default private).

Installing and Working with Sourcetree & git repos

Here you are going to learn about how to clone, pull and push file using sourctree. so for this process you have already install gitbash and also should install sourctree. now i am going to describe you how to install sourcetree.

  • open your browser (chrome/mozilla firefox etc)
  • search sourcetree
  • click on https://www.sourcetreeapp.com/ url
  • then download using button Download for windows or Mac OS X

when your software will download then run it and follow some steps and after click 4 times on next button your software will be installed.

then you have to open this software. after opening Sourcetree your Sourcetree will look like this:

sourcetree main view

Now i am going to show you how can you clone a repo from bitbucket repo.

  • click on clone button
  • then go to bitbucket and copy clone url and paste it into Source Path / URL : of input box in sourcetree
  • then Click on Destination Path:Browse button for selecting your local system location for cloning
  • then click on Clone button
  • after some time your repository will be clone into your local system.

now i am going to show you how to commit a file using sourcetree.

  • first of all, you should check File Status on the left side menu for commit all changes or selected file.
  • after that click on selected file if you want to commit some file then select using ctrl + click to select file and click on Stage Selected button or if you want to commit all changes then simply click on Stage All button
  • then type comment in the footer area where one textarea type box is available and then click on Commit button situated in lower right corner
  • then click on push button and you will see one popup and then click on push button.

You can check out more details on below reference. if you want to learn more things then you should follow official documentation .

if you like our blog then please share it with your developer friends. and comment us if you want to suggest us something.

How to use Bitbucket and Sourcetree

Bitbucket is a version control system. A version control system (VCS) is where programmers can store their code at various stages of development, so that they can restore previous versions easily when there is a requirement. Bitbucket is based on Git, which is one of the most popular VCS. Git was created by Linus Torvalds, who also created the Linux operating system.

Bitbucket can be used either as a cloud-based VCS repository or installed as an in-house application within an organization where the development teams can store their source codes. The main advantage is that it helps much with collaboration among the developers.

In this introductory tutorial, let us see how to create a repository on the Bitbucket cloud and use it for storing source files.

Registration at Bitbucket Cloud and Installation of Sourcetree

To start with, you need to create an account at bitbucket.org.

1] Login to bitbucket.org and click on “Get it free” to sign up for new id or login with a gmail / Microsoft / Apple ids if you do not have a previously registered login.

2] Specify a username for bitbucket cloud and click continue.

3] Once you login to bitbucket cloud, the welcome screen shows the option to create new repository or import existing repository. Also, there is a button to create workspace for team collaboration.

4] Sourcetree is a GUI client for Bitbucket. This is an equivalent of the Git command line client. Sourcetree can be downloaded from https://www.sourcetreeapp.com/. Click on the Download button and accept the agreement check mark followed by clicking on Download button again.

5] Double click on downloaded binary to launch the installation of Sourcetree. During the installation process, in the popup window, click on “Bitbucket” icon and click Next. The same registration id used previously with bitbucket has to be used in order to connect sourcetree client with bitbucket cloud.

6] Once login to bitbucket is successful, a “Registration complete!” message appears. Click “Next” to continue with the installation of client tools. Select “Git” and unselect “Mercurial” and click “Next”.

7] Once the Git client installation is done, “Tool installation completed.” message appears. Click Next and in the following Preferences window, enter the bitbucket username and the email id used for bitbucket cloud registration. This will finish the installation process and open sourcetree application window.

Create a repository

1] At Bitbucket click on “Create repository” button

In the “Create a repository – Bitbucket” window, enter the project name, repository name, check the access level as “Private repository” and other settings as indicated below and then click “create repository”

2] The new bitbucket repository is created. In the next window, it displays a command “git clone https://….git“. This command can be used to clone this repository if the Git command line client is used. We can use the URL (the value after git clone i.e., https://……git) will have to be used to specify the remote repostory’s URL at sourcetree.

3] At Sourcetree, click on “+” icon (Create) in order to create a local repository. The folder where repository files are stored can be specified either by entering it at the specified text box or by exploring the filesystem by clicking at the “BROWSE” button. Also specify the name of the repository and the type of version control system (Git) and then click “Create” button.

4] Click “yes” if a prompt appears asking for confirmation to create the repository at the specified folder. Once the repository is created, a hidden folder called “.git” will appear at the repository folder. The .git folder contains configuration settings associated with the Git client. Don’t touch this hidden directory for now.

Adding and Updating Files to Repository

5] Create a new text file called Testing1.txt at the local folder designated for the repository and add some content to it. Then save it.

6] As soon as the new file is added, the sourcetree shows it as “Uncommitted changes” and the filename appears under “Unstaged files”. select the filename and click on “Stage selected”. The filename now appears under “Staged files”.

7] Click the “commit” icon in the top. Specify few comments such as “First commit” in the text box at the bottom of the window and click on the “Commit” button below. This might prompt to confirm the full name and email id. Click ok after verifying the values.

8] From the top menu, select “Repository -> Repository Settings”. This will open the “repository settings” popup window.

9] Click “Add” button and then specify the URL (as specified in step 2 above) and remote name as well as the bitbucket account name and click OK. Again, click OK at the next prompt.

10] At the local folder associated with the repository, add another file called “README.md”, add few introductory contents to it and then save it. At the sourcetree, stage the new file and click on “Commit” icon. Add a comment about reason for this commit and then click on “Commit” button.

11] At sourcetree, click on “Push” button. This will open a new popup window. Check the box which indicates local branch as “master” and specify remote as “master” and then click “Push”. At the CredentialHelperSelector window, select “manager-core” and check the box “Always use this from now on”. The files get pushed to remote now.

12] Refresh Bitbucket and open source and verify if the files are listed under master branch.

Использование SourceTree

Установка программы Atlassian SourceTree и способы клонирования репозитория.

Установка

  • Скачать SourceTree можно свободно с сайта программы.
  • Для установки требуется доступ в Интернет и регистрация на сайте Bitbucket.

Клонирование репозитория

Для работы с исходным кодом необходимо сделать копию репозитория на ваш компьютер (клонировать репозиторий)

Общий способ клонирования

  1. В SourceTree нажмите кнопку Клонировать/создать
    alt=»Кнопка Клонировать/создать в SourceTree» width=»300″ height=»68″ />
  2. В окне Клонировать / добавить / создать репозиторий в поле Исходный путь / URL введите URL-адрес репозитория. При этом в поле Тип репозитория должна отобразиться строка Это репозиторий Mercurial или Это репозиторий Git .
    С помощью кнопки рядом с полем Целевой путь выберите папку, в которую будет клонирован репозиторий.
    В области Закладки в поле Название укажите произвольное имя репозитория для идентификации его в SourceTree.
    Нажмите кнопку Клонировать.
    Окно Клонировать / добавить / создать репозиторий в SourceTree
  3. После успешного клонирования отобразится окно с соответствующим сообщением.
    Окно с информацией об успешном клонировании репозитория в SourceTreeПосле закрытия окна, репозиторий появиться в левой области, а в правой откроется вкладка с содержимым проекта
    Содержимое репозитория

Клонирование из Bitbucket

  1. Войдите в Bitbucket в нужный проект и нужный репозиторий.
  2. Слева в списке выберите пункт Код.
  3. Нажмите на кнопку со стрелкой и в открывшемся диалоговом окне нажмите кнопку Проверить в SourceTree.
  4. После запуска SourceTree откроется окно URL Actions на вкладке Clone New.
    С помощью кнопки рядом с полем Destination Path (Целевой путь) выберите папку, в которую будет клонирован репозиторий.
    В области Bookmarks (Закладки) в поле Name (Название) укажите произвольное имя репозитория для идентификации его в SourceTree.
    Нажмите кнопку Clone (Клонировать).
  5. После успешного клонирования отобразится окно с соответствующим сообщением.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Школа онлайн с государственным аттестатом