It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can't 'push' to bitbucket

I am following Django For Beginners and attempting to complete the chapter two exercise, part of which is setting up and loading my project to Bitbucket.  I can't get it to work, I've tried several different things, researched other issues and can't make it happen.  Any help, advice and/or assistance will be greatly appreciated.  Here's what the book instructs me to do and what I get:

PS C:\helloworld> git remote add origin https://username@bitbucket.org/username/hello-world.git
fatal: remote origin already exists.
PS C:\helloworld> git push -u origin master
remote: Not Found
fatal: repository 'https://username@bitbucket.org/username/hello-world.git\/' not found
PS C:\helloworld>

2 answers

1 vote
Mikael Sandberg Community Leader Jul 02, 2018

Hi Steven,

Welcome to the Atlassian Community.

Have you created the repository in Bitbucket?

Hi Mikael!

I'm editing my response from earlier.  Upon further examination, I still don't think I have properly uploaded my project to Bitbucket.  All I seem to have in the repository is a README.md document.  I am adding another image to this reply.  Thank you again for your help!

SteveBitBucketImage070518.png

Thank you VERY MUCH for your quick response!

Yes, I've attached a screen image.

 

BitbucketAtlassianProblem070218.jpg

Mikael Sandberg Community Leader Jul 02, 2018

Okay, so try and update the URL. In Bitbucket click into your repository, click Clone and copy the URL. Then from within your repository locally run this command:

git remote set-url origin <URL copied from Bitbucket>

You can then run

git remote -v  

 Verify that the URL looks correct.

Like Jonathan Damiani likes this

Thank you Mikael!

I think that did it!

Here's a screen shot of the Download repository:BitbucketAtlassianProblem_3_Downloads_070218.jpg

0 votes

Could you open the hello-world repository. There must be a command with the correct origin url. 

Hello Alexey!

I have attached a screen print image of the hello-world repository.  All that is in there is README.md.

Your advice will be greatly appreciated!

Thanks!BitBucketImage070518_2.jpg

Steve

Mikael Sandberg Community Leader Jul 06, 2018

On your local machine inside the repository, run 

git remote -v 

Verify that the URL looks correct. You can always click on Clone in Bitbucket and copy the URL from there and change it on your local repository by running

git remote set-url origin <URL copied from Bitbucket>

Also, make sure you have committed your local changes to the repository by running

git status 

If all your changes are committed it should say something like this

$ git status
On branch bugfix/CR-234-fixing-somthing
Your branch is ahead of 'origin/bugfix/CR-234-fixing-somthing' by 2 commits.
(use "git push" to publish your local commits)

nothing to commit, working tree clean

In the example above my local copy of the branch has two commits that have not yet been pushed to Bitbucket. 

Hi Mikael!

Thank you, again.

This is what I get after running git status:

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        hello-world/

nothing added to commit but untracked files present (use "git add" to track)

Mikael Sandberg Community Leader Jul 06, 2018

@Steven Jones Okay, so you have not committed your changes to the repository yet, that is what the untracked files means. If you run

git commit -am "your commit message"

This will combine git add and git commit, and once you have run this command you can run git push to push your local changes back to Bitbucket. 

Here's what I get:

 

PS C:\sdj\programming\django\DjangoForBeginners\helloworld> git commit -am "Commit 070618 14:55"
On branch master
Untracked files:
        hello-world/

nothing added to commit but untracked files present
PS C:\sdj\programming\django\DjangoForBeginners\helloworld> git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

PS C:\sdj\programming\django\DjangoForBeginners\helloworld>

Jim Redmond Atlassian Team Jul 08, 2018

You'll need to add the files to git before committing them:

git add hello-world

 This will tell git to start tracking the file named "hello-world". You can also list multiple files or use wildcards if that'd be faster.

Once git knows to track "hello-world", then you can commit:

git commit -am "put a useful commit message here"

And once you've committed, you can push:

git push --set-upstream origin master

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

4,032 views 4 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you