Push updates to a repo

Once you have changed your code and other files in your local repository, you will need to push them to the remote Bitbucket repository so that other people can see them too.

Shallow clones unsupported

Bitbucket does not support shallow clones. A shallow clone is created by restricting the clone's history to a revision subset. You cannot push a shallow clone to Bitbucket.

You need write permission for the repository to be able to push to the repository. See Repository privacy, permissions, and more.

Mercurial push example

  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 https://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)
    

Git push example

  1. Enter git push at the command line prompt in your local project directory, to copy your files from your local repository to Bitbucket.

    git push
    
  2. When prompted for authentication, enter your Bitbucket username and password.
    Example:

    $ git push
    Password:
    Counting objects: 6, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (4/4), 23.98 KiB, done.
    Total 4 (delta 0), reused 0 (delta 0)
    remote: bb/acl: alui is allowed. accepted payload.
    To https://alui@staging.bitbucket.org/alui/alui-git-fork.git
       0ad86b3..395d3c2  master -> master
    

Open your Bitbucket repository in your browser. The Overview tab shows your most recent commits in the activity stream on the right:

RELATED TOPICS

Cloning a Bitbucket Repository
Work on local source files

Was this helpful?

Thanks for your feedback!

22 Archived comments

  1. User avatar

    Thomas Pasch

    At present 'git push -f' is a potential dangerous command - and there is no way to disallow it (if the user has 'write' access). This is because it is impossible to set the receive.denyNonFastForwards option on a bitbucket repository.

    25 Jan 2013
  2. User avatar

    Eduardo Werley

    Hi, is it possible to checkout an old commit (revert to an old commit)? Thanks.

    09 Feb 2013
  3. User avatar

    Anonymous

    Is it possible to push to a bitbucket repository without having mercurial/git installed? Thanks

    15 Feb 2013
    1. User avatar

      manthony

      Hi. No, it isn't possible to push a repository to Bitbucket without either Mercurial or Git on your local machine.  If you are looking to host files and not repositories, you should look at file hosting services such as Dropbox.  

      15 Feb 2013
  4. User avatar

    Anonymous

    I modified the local repo, then i did git status and git commit, everithing ok but, when I try to git push is telling me this: 

     

    /Repos/free_a13$ git push
    Password: 
    error: The requested URL returned error: 403 while accessing https://ajgallegog@bitbucket.org/cicamargoba/free_a13.git/info/refs

    fatal: HTTP request failed

     

     

    and I have write access. What can I do to fix this?

    08 Mar 2013
    1. User avatar

      manthony

      It appears you are over your plan limit. See this Knowledge Base article for information on fixing the issue: 403 while accessing https://{username}@bitbucket.org/{username}/{repo slug}.git/info/refs

      08 Mar 2013
  5. User avatar

    Anonymous

    If I delete a file that has become redundant, how do I commit and push that?

     

    17 Apr 2013
    1. User avatar

      manthony

      Both Git and Mercurial allow you to do this. For Git:

      For Mercurial:

      17 Apr 2013
  6. User avatar

    Anonymous

    I create a new branch and use "git push" in new branch, but when I open Bitbucket repository in my browser, the Overview tab did not shows my most recent commits.

    02 May 2013
    1. User avatar

      manthony

      You need to make sure you are looking at the proper branch commits.  I'll add some documentation on this.

      02 May 2013
  7. User avatar

    Anonymous

    When I'm pushing updates to a repository where I am added as a user, the overview page shows that the owner of the repository pushed a commit, and the commit page shows I made the commit. What did I do wrong in the config so the push is made as the owner of the repository? I am not asked for a user name, only for the password and if I put my password in I get an authentication failure..

    15 Jun 2013
    1. User avatar

      Anonymous

      I forgot to specify: I'm using GIT.

      15 Jun 2013
  8. User avatar

    Anonymous

    I can't push to the repo im working at anymore.

    It tells me that the repo was not found (Its a private repo, the repo exists of course).

     

    Output:

    13 Jul 2013
    1. User avatar

      manthony

      Can you clone it successfully to your machine? If you can do that, you might want to check your command line...

      15 Jul 2013
  9. User avatar

    Anonymous

    i push a commit to bitbcuket ip show in overview tabb but in commits tab it only show in master brancha not in show all

    01 Aug 2013
    1. User avatar

      manthony

      Commits only show up in the branch in which they were made. To get the change from one branch to another, you need to merge the branches.  You can do the merge locally on your machine or use a pull-request across branches.

      01 Aug 2013
      1. User avatar

        Anonymous

        the thing is that the commit dont appear in history commit but in master history it does. i mean if i just see the master commits i see my commit, but when i choose show all i cant see it

        01 Aug 2013
        1. User avatar

          manthony

          Please send an email to support@bitbucket.org.  Include a screen capture of the problem please.

          01 Aug 2013
  10. User avatar

    Anonymous

    How do you determine which branch a push request will write to?

    20 Aug 2013
    1. User avatar

      manthony

      Mercurial will push/pull all branches by default, while git will push/pull only the current branch.

       With Git, you should specify the branch. So, this pushes the serverfix branch only.

      So, the syntax is:

      git push <remotename> <branchname>

      For Mercurial, Iif you want to push/pull only a single branch with Mercurial you can use the --revoption (-r for short) and specify the tip revision of the branch. Otherwise, you can just do:

      hg push 

      And it will push the currently checked-out branch. 

      21 Aug 2013
Powered by Confluence and Scroll Viewport