

#Git clone branch from remote code#
clone and fetch download remote code from a repository's remote URL to your local computer, merge is used to merge different people's work together with yours, and pull is a combination of fetch and merge. Now that I have the site installed on my local machine as well as my live server, I'm ready to make a change locally and push it to the live site.These commands are very useful when interacting with a remote repository.
#Git clone branch from remote install#
The fact that we even see the installation page means our clone was successful, but I'll go ahead and install Drupal so that we can use it in later videos. Since this is a Drupal installation, I'm prompted to install Drupal and specify the database etc. This means that we can now navigate to our site in a web browser and see the site. Nothing to commit (working directory clean) If everything was successful, you should see the message: When it's done, you can move into the repo by typing "cd public_html" (or whatever you named the repo directory) and typing "git status". Clone the repo by typing "git clone " and pressing Enter (In my case the command will be "git clone public_html")Īt this point, you should see some indication that the repo is being cloned to your server.If you're on a VPS, you probably don't need to do this, but if you're on a shared host you probably do.) Optional: Delete the placeholder "public_html" directory by typing "rm -rf public_html" (If your server requires the root of your site be in a folder like "public_html" we need to delete that directory, and clone our repo to the same location with the same directory name.Switch to the terminal session where you are connected to the server via SSH.Copy the SSH URL at the top of the page.On the BitBucket page, click "Repositories" and select the repo you want to clone.If you receive an "access denied" message, read the Troubleshoot SSH Issues help page. If the username is yours, you've successfully setup your SSH key! (Don't worry about the "shell access" statement. You can use git or hg to connect to Bitbucket. Now you'll see a message like the following: If prompted for your password, enter the one you used when creating the ssh key on your server.The authenticity of host ' (192.30.252.128)' can't be established. Now you might see a warning like the following: The process to do so is actually quite simple. Now that you have your SSH key uploaded, it's a good idea to test it to make sure that it's working before you proceed. Now, you'll see the label of your new Key in the list. ie: Work Computer, Personal Laptop, Live Server etc.) Label: My Git Site Live Server (The title is used to differentiate your computers because you can upload SSH keys from multiple computers.In the top right corner of the BitBucket page, click the "user" icon and select "Manage account".

Now that you have it copied, you need to add it to your BitBucket account. When you have it copied, press "q" to quit the less application. Regardless of how you created your key (via the command line or the web interface) you can copy your key by connecting to your server via ssh and typing "less ~/.ssh/id_rsa.pub", then copying everything from "ssh-rsa" to the end of your email address. I'll do this in BitBucket, but if you're working with GitHub, you can follow the steps in the video Adding Your SSH Key to Your GitHub Account to do the same thing there. Once the key has been created, you'll need to add it to your Git host. If that's the case, you can follow the instructions in the video Generating an SSH Key to Connect with Remote Repositories to create your SSH key. If your server does not have a control panel, you'll need to do it in the command line. If that's the case, the key is usually created through that interface. Many will have a control panel like cPanel or Plesk. This process varies from host to host, so check with your hosting provider for the proper way to create SSH Keys on their platform. In order to clone the repo to your server, you must first setup an SSH key on your server. Now that we have a remote repository setup, the next logical step is to clone the repo to your live server so that you can push the changes that you make locally up to your live site.
