In the past I’ve used svn and cvs, but never BitBucket or Git. I just got a BitBucket account with an empty project associated.
I read Getting Started with Bitbucket and on my BitBucket page that I am supposed to do the following:
git clone https://bitbucket.org/REST_OF_URL/...
I use the URL provided by Git; it successfully accepts my password without any trouble. It does, however print the following:
warning: You appear to have cloned an empty repository.
This made sense to me, because I just signed up for BitBucket.
This makes a directory called myproject. I then copied a file to that directory and added it to the repository:
cd myproject
echo 'Hello Git!' > hello.txt
git add hello.txt
I checked the status:
git status
and saw that hello.txt was recognized as a new file.
I then tried to push the file to the server:
git push https://bitbucket.org/REST_OF_URL/...
again, I typed in my password and it didn’t complain.
It reads:
Everything up-to-date
But the file has not shown up in my online Git project. I also noticed there is a git commit command. I tried this as well:
git commit -m "Initial project set up"
The output reads:
Your name and email address were configured automatically based on
your username and hostname. Please check that they are accurate.
Since the file still hasn’t shown up in my directory, I feel like I must have made a local commit on my own machine. Can anyone help me by telling me
- What I’m missing to set up a simple project with Git
- Where I’ve committed these files on my local machine (I’m hard up for disk space and don’t want any clutter)
As another user experienced from the Git BitBucket manual it transfers only when you push with
git push origin master
but does not work when you push with
git push
This resolves my issue, but I still do not know why this happens.
The simple solution is push with master branch at first time:
Then after that, you can use
git pushfor default push to Bitbucket (master branch).