Can't 'push' to bitbucket

Steven Jones July 2, 2018

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

2 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 2, 2018

Hi Steven,

Welcome to the Atlassian Community.

Have you created the repository in Bitbucket?

Steven Jones July 2, 2018

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 2, 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.

Steven Jones July 2, 2018

Thank you Mikael!

I think that did it!

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

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 2, 2018

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

Steven Jones July 5, 2018

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 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. 

Steven Jones July 6, 2018

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 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. 

Steven Jones July 6, 2018

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>

jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 8, 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
Steven Jones July 9, 2018

Deleted prior response.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events