Reputation: 12396
I have a local directory on my Windows machine that I am trying to:
git init
README.md
file to this repositoryREADME.md
file to bitbucketHowever I am having trouble with the commands (steps 2. and 3.) that come after git init
I have tried this:
git init --bare tHartman3
git remote rm origin
git add -A
git remote add origin https://bitbucket.org/<username>/tHartman3
Now, I am ready to commit so I try:
git commit -m "Created blank README.md file for tHartman3 repository"
but it gives the following error
On branch master
nothing to commit, working tree clean
Then I try
git push -u origin master
But this gives this error
remote: Not Found
fatal: repository 'https://bitbucket.org/<username>/tHartman3/' not found
When I just try
git push
I get this error
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
I am not sure what is going on with this since:
git remote add origin https...
seemed to have worked.git remote -v
looks goodI have followed instructions from here and here.
Additional Notes:
git remote add origin https://bitbucket.org/<username>/tHartman3
or git remote add origin https://bitbucket.org/<username>/tHartman3.git
I still get the same output for all other following commands.Question
Is there something missing from here to create this local tHartman3
directory to a .git
repository?
Upvotes: 2
Views: 3846
Reputation: 114230
First and foremost, create the remote repository on BitBucket. You need this to be able to push to it. Pushing only works if there is something to push to on the other end. Here are some off-site instructions: https://confluence.atlassian.com/bitbucket/create-and-clone-a-repository-800695642.html
Once you have a repo, you have a couple of options for how to get a working local copy of it. The harder way is to make the (non-bare) repo and set up the remote manually:
git init tHartman3
git remote add origin ssh://<username>@bitbucket.org/<username>/tHartman3
Keep in mind that bare repos do not have a working directory. They are used pretty much only for hosting a central repository since you can not actually check out any files in them.
The easier way to make a local clone is just to run the command that bitbucket shows when you click on the clone button:
git clone ssh://<username>@bitbucket.org/<username>/tHartman3
Now you can add your readme and run git -A
. Before you commit, it is usually a good idea to run git status
. If you do not have any staged files, the commit will fail. Add any files you need manually in that case:
git add README.md
Now the commit and push should work smoothly:
git commit -m '...'
git push
Upvotes: 2