Heroku, Git, Bitbucket - What's happening where?
<p>This is a follow up to <a href="https://stackoverflow.com/questions/13240227/deploying-to-heroku-using-git-on-bitbucket">Deploying to Heroku using git on bitbucket</a>.</p>

<p>I am not new to Ruby on Rails (RoR). I am new to git, Heroku, and Bitbucket.  I'm missing some fundamental concepts I am just not getting reading books and playing around.  </p>

<p>I have followed along with <a href="https://devcenter.heroku.com/articles/getting-started-with-jruby#introduction" rel="nofollow noreferrer">https://devcenter.heroku.com/articles/getting-started-with-jruby#introduction</a>. It has been invaluable in getting me started with deploying RoR to Heroku. If I follow along closely, things work.  My questions below assume everything in that tutorial is working correctly. </p>

<p>I'm hoping these very basic questions will help others facing the same learning challenges I am.</p>

<p>My first basic question: Are Heroku repositories private by default?</p>

<p>My second basic question: What does the <code>heroku</code> command do?  Sometimes it seems to run something on the server as in <code>heroku config:set MY_VARIABLE=MY_VALUE</code> which, I think, sets an environment variable on the server running my website.  Sometimes it seems to run things on my devlopement (i.e. local) machine as in <code>heroku local web -f Procfile.windows</code></p>

<p>For the sake of argument, assume a Heroku repository is not private and I want to host my repository (repo) on Bitbucket.</p>

<p>After installing the Heroku toolbelt, I have done a <code>git clone https://github.com/heroku/jruby-getting-started.git myProject</code> from a command processor.</p>

<p>Ok, I understand the "git clone".  If my current working directory is f:\x then the clone operation will create f:\x\myProject (and subdirectories) complete with sample code as well as a repository.</p>

<p>I make and save my changes to the local (sample) files (e.g. f:\x\myProject\app\views\index.erb) with my favorite text editor. (In my case, the Atom text editor.)</p>

<p>I do <code>http://localhost:5000</code> allows me to see myProject on a local browser.  This works fine.</p>

<p>I then do a </p>

<pre><code>    git add .
    git commit -m "Some comment"
    git push heroku master
    heroku open
</code></pre>

<p>So now I pushed the changed sample code to Heroku. The <code>heroku open</code> opens a new tab in my web browser. Magically, myProject.heroku.com is now working with the changes I made to f:\x\myProject\app\views\index.erb. </p>

<p>Assume I want to host my repository on Bitbucket.</p>

<p>Now I get lost.  Do I clone f:\x\myProject to Bitbucket?  Do I push to Bitbucket?</p>

<p>I note from <a href="https://devcenter.heroku.com/articles/git" rel="nofollow noreferrer">https://devcenter.heroku.com/articles/git</a></p>

<blockquote>
  <p>Before you can push an app to Heroku, you’ll need to initialize a local
  Git repository and commit your files to it. For example, if you have an
  app in a directory, myapp, then create a new repository for it:</p>
</blockquote>

<p>Is that really true? Is there no way to push from Bitbucket to Heroku without having a repository on Heroku?</p>

<p>I'm running Windows 7 with Cygwin and Heroku's toolbelt installed. What tool do I use to create and copy my local repository to Bitbucket?</p>

<p>Once I have a repo on Bitbucket, what tool and git commands do I use to place my code on Heroku <strong>without</strong> creating a repo on Heroku or updating the repo?</p>

<p>Thank you.</p>