Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push local changes to a remote Git repository on Bitbucket

Tags:

git

bitbucket

I'm testing out Git and Bitbucket.

I've created a repository on Bitbucket and have created a local copy of the repository and I am committing files into it. I can't seem to push the files from my local repository to the remote repository.

Here's what I'm doing:

git clone https://[email protected]/me/test.git cd test touch dummy git add dummy git commit dummy -m "my first git commit" git push 

The final line outputs:

Everything up-to-date 

And when I log on to Bitbucket I can’t see my dummy file.

What am I doing wrong?

Doing this worked:

 git push origin master:master 

What is the explanation as to the difference between this and a simple git push?

like image 230
Joel Avatar asked Oct 07 '11 16:10

Joel


People also ask

How do I push local changes to remote repository?

Push a new Git branch to a remote repo Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch.


1 Answers

Use git push origin master instead.

You have a repository locally and the initial git push is "pushing" to it. It's not necessary to do so (as it is local) and it shows everything as up-to-date. git push origin master specifies a a remote repository (origin) and the branch located there (master).

For more information, check out this resource.

like image 68
Chuck Callebs Avatar answered Sep 20 '22 06:09

Chuck Callebs