123HELPDESK

IT professionals voor ondernemers

Bitbucket How To PDF Afdrukken
 

Step 1. Sign Up for Bitbucket

  1. Sign up at Bitbucket.org.

Step 2. Create your Bitbucket Repository

Note: You can skip this section if you are joining an existing Bitbucket repository.

  1. Click the 'Create new' button  on your Bitbucket home screen.
  2. Enter a name and description for your repository.
  3. Tick 'Private' if you want to hide your repository from the general public, so that only selected people can see it.
  4. Click 'Create repository'.

If you need more detail on adding new repositories, please read Creating a Bitbucket Repository.

Step 3. Download and Install Mercurial and its Dependencies

Note: You can skip this section if you are already using Mercurial.

  1. Get Mercurial and Python:
    • Download and install each one separately:
    • Alternatively, if you are on Windows you can download and install TortoiseHg. (This bundles Python and Mercurial.)
  2. Add or edit your Mercurial configuration file.

    If you are on Windows XP, Windows Vista or Windows 7, you will probably need to add the file because it does not exist at all. The file should be at the following location:

    • UNIX-based systems: ~/.hgrc
    • Windows XP: C:\Documents and Settings\MY_NAME\mercurial.ini
    • Windows 7: C:\Users\MY_NAME\mercurial.ini

    Add your name, email address and preferred text editor to the configuration file, so that the file contains at least the content shown below:

    [ui]
    ; editor used to enter commit logs, etc.  Most text editors will work.
    editor = notepad
    username = MY_FIRST_NAME MY_LAST_NAME <
     Dit e-mail adres is beschermd door spambots, u heeft Javascript nodig om dit onderdeel te kunnen bekijken
     >
    

Step 4. Clone the Bitbucket Repository to your Local Drive

  1. Open a command window and go to the local directory where you want to create your repository.
  2. Clone the repository.
    hg clone http://bitbucket.org/MY_USER/MY_REPO
    

    Example:

    D:\Atlassian\BitBucketTesting\BitbucketRepository>hg clone http://bitbucket.org/sarahmaddox/sarahmaddox
    destination directory: sarahmaddox
    no changes found
    updating to branch default
    0 files updated, 0 files merged, 0 files removed, 0 files unresolved
    
  3. A new sub-directory appears, with the same name as the Bitbucket repository that you have cloned. The sub-directory contains a folder called .hg. That is your Mercurial repository, containing the files and metadata that Mercurial requires to maintain the list of changes you make. Here is its structure as seen in Windows Explorer:

Step 5. Work in your Local Repository

You will use the Mercurial commands to work on files in your local repository. See the Mercurial documentation for details. Here are the basics:

  • Adding new files: Add or copy the file to your local project directory, then enter hg add to add all new files to the repository at the next commit.
  • Editing files: Just edit the file in your local project directory and save your changes.
  • Removing files: Delete the file from your local project directory, then enter hg remove to remove the file from the repository at the next commit.
  • Committing your changes to the local repository: Enter hg commit at the command line. To include a commit message, use this syntax:
    hg commit -m "My commit message."

See our example in Working on Files in your Local Mercurial Repository.

Step 6. Push your Local Repository to Bitbucket

  1. Enter hg push at the command line prompt in your local project directory, to copy your files from your local repository to Bitbucket.
    hg push
    
  2. When prompted for authentication, enter your Bitbucket username and password.
    Example:
    D:\Atlassian\BitBucketTesting\BitbucketRepository\sarahmaddox>hg push
    pushing to http://bitbucket.org/sarahmaddox/sarahmaddox
    searching for changes
    http authorization required
    realm: Bitbucket.org HTTP
    user: sarahmaddox
    password:
    remote: adding changesets
    remote: adding manifests
    remote: adding file changes
    remote: added 2 changesets with 16 changes to 11 files
    remote: bb/acl: sarahmaddox is allowed. accepted payload.
    remote: quota: 108.9 KB in use, 1.0 GB available (0.01% used)
    

Other Useful Mercurial Commands

  • Enter hg log to see the log of changes committed to the repository. For example:
    D:\Atlassian\BitBucketTesting\ArticlesRepository>hg log
    changeset: 0:91265b6b40af
    tag: tip
    user: Sarah Maddox <
     Dit e-mail adres is beschermd door spambots, u heeft Javascript nodig om dit onderdeel te kunnen bekijken
     >
    date: Mon Jul 26 11:40:54 2010 +1000
    summary: Adding all files to the repository for the first time.
    
  • Enter hg status to see the status of the files in your repository.
    I modified one file, deleted an image and added another file. Here is the result of the hg status command before I committed the changes:
    D:\Atlassian\BitBucketTesting\ArticlesRepository>hg status
    M techw_story1.htm
    ! bauble.gif
    ? techw_story1 - Copy.htm
    

    The characters in front of the file names have the following meanings:
    M – File modified.
    ! – File deleted.
    ? – New file. (Mercurial does not know about this file yet.)
    Other characters may appear too. Refer to the Mercurial documentation for their meanings.

More about Mercurial
RELATED TOPICS
 
< Vorige   Volgende >