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
?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With