I'm testing out Git and Bitbucket.
I've created a repository on Bitbucket and have created a local copy of the repo and am committing files into it. I cann't seem to push the files from my local repo to the remote repo.
Here's what I'm doing:
git clone https://me@bitbucket.org/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 cann't see my dummy file.
What am I doing wrong?
EDIT:
Doing this worked:
git push origin master:master
Any explanations as to the difference between this and a simple git push
?
I'm with Git downloaded from https://git-scm.com/ and set up ssh follow to the answer for instructions https://stackoverflow.com/a/26130250/4058484.
Once the generated public key is verified in my Bitbucket account, and by referring to the steps as explaned on http://www.bohyunkim.net/blog/archives/2518 I found that just 'git push' is working:
Shell respond are as below:
It even works for to push on merging master to gh-pages in GitHub
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.
This is a safety measure to avoid pushing branches that are not ready to be published. Loosely speaking, by executing "git push", only local branches that already exist on the server with the same name will be pushed, or branches that have been pushed using the localbranch:remotebranch syntax.
To push all local branches to the remote repository, use
--all
:or specify all branches you want to push:
In addition, it's useful to add
-u
to the "git push" command, as this will tell you if your local branch is ahead or behind the remote branch. This is shown when you run "git status" after a git fetch.