<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Teresia Kirung'o</title>
    <description>The latest articles on DEV Community by Teresia Kirung'o (@teresia-kirungo).</description>
    <link>https://dev.to/teresia-kirungo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F329343%2Fe23ac3a7-44a8-4348-a0ad-30d44614f831.jpg</url>
      <title>DEV Community: Teresia Kirung'o</title>
      <link>https://dev.to/teresia-kirungo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/teresia-kirungo"/>
    <language>en</language>
    <item>
      <title>Connecting Your Sandbox to your GitHub repo? You’ve come to the right place!</title>
      <dc:creator>Teresia Kirung'o</dc:creator>
      <pubDate>Tue, 18 Jul 2023 09:14:29 +0000</pubDate>
      <link>https://dev.to/teresia-kirungo/connecting-your-sandbox-to-your-github-repo-youve-come-to-the-right-place-546a</link>
      <guid>https://dev.to/teresia-kirungo/connecting-your-sandbox-to-your-github-repo-youve-come-to-the-right-place-546a</guid>
      <description>&lt;p&gt;Recently I found myself stuck when I needed to test source code for some product release in an integrated virtual environment. Having never used a sandbox before, I found myself in a pretty exciting place, so,&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a sandbox?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;sandbox&lt;/strong&gt; is an isolated and controlled environment where software or code can be executed, tested, and experimented with without affecting the production or live environment.&lt;/p&gt;

&lt;p&gt;The term &lt;em&gt;&lt;strong&gt;“sandbox”&lt;/strong&gt;&lt;/em&gt; is often used metaphorically to describe a play area where children can freely explore and experiment within the confines of a designated space without causing harm. Similarly, in technology, a sandbox provides a safe and controlled environment for developers, testers, or users to perform various activities without damaging the system or data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key aspects of a sandbox environment:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Isolation:&lt;/strong&gt; A sandbox provides a segregated environment that is isolated from the production or live environment ensuring that any activities or changes made within the sandbox do not affect the main system or infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testing and experimentation:&lt;/strong&gt; Sandboxes are commonly used for testing new software, applications, or code. Developers can deploy and run their code within the sandbox environment to observe its behavior, identify issues, and verify its functionality without risking disruption to the production system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security and protection:&lt;/strong&gt; Sandboxes offer a layer of security by limiting the actions and access permissions within the environment. It helps prevent malicious code or activities from impacting the main system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Controlled environment:&lt;/strong&gt; Sandboxes often come with specific configurations and restrictions to create a controlled environment. This control allows developers or users to replicate certain conditions or scenarios to observe and analyze the behavior of software or code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sandbox environments can be implemented in various ways, such as &lt;em&gt;virtual machines&lt;/em&gt;, &lt;em&gt;containers,&lt;/em&gt; &lt;em&gt;cloud-based platforms&lt;/em&gt;, or &lt;em&gt;dedicated testing environments&lt;/em&gt;. They provide a valuable tool for &lt;em&gt;software development&lt;/em&gt;, &lt;em&gt;testing&lt;/em&gt;, and &lt;em&gt;security purposes&lt;/em&gt;, enabling experimentation and innovation while minimizing risks.&lt;/p&gt;

&lt;p&gt;In this instance, I needed to connect my GitHub repo to the provided sandbox, then work on that Repo as I would if I was working on my local computer, so how did I go about connecting the two?&lt;/p&gt;

&lt;h2&gt;
  
  
  Sandbox Details:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Credentials
Host: aa4d5567891b.23a45fbf.abc-efg.testing
Username: aa4d5567891b
Password: a4567788901w2bbcc34c
Web access:
HTTP HTTP 3000 4000 5000 5001 8000 8080
Port mapping
SSH -&amp;gt; 35290 |  HTTP -&amp;gt; 35289 | HTTPS -&amp;gt; 35288 
3000-&amp;gt; 35287 | MySQL -&amp;gt; 35286 | 4000 -&amp;gt; 35285
5000 -&amp;gt; 35284 | 5001-&amp;gt; 35283 | 8000-&amp;gt; 35282 | 8080-&amp;gt; 35281
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Among the options provided above to access the sandbox here’s how to set it up via:&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect to the sandbox via SSH(Secure Shell):
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once your virtual machine or server is provisioned, you can connect to it using an &lt;em&gt;&lt;strong&gt;SSH&lt;/strong&gt;&lt;/em&gt; client.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you're on a Unix-based system (such as Linux or macOS), you can open/navigate to your preferred Command line terminal type the following ssh command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh username@your_sandbox_ip_address
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Replace &lt;strong&gt;&lt;code&gt;username&lt;/code&gt;&lt;/strong&gt; with the appropriate &lt;strong&gt;&lt;code&gt;username for your virtual machine or server&lt;/code&gt;&lt;/strong&gt;, in our case &lt;strong&gt;&lt;code&gt;aa4d5567891b&lt;/code&gt;&lt;/strong&gt;  and &lt;strong&gt;&lt;code&gt;your_sandbox_ip_address&lt;/code&gt;&lt;/strong&gt; with the IP address or domain name of your sandbox in thus case &lt;strong&gt;&lt;code&gt;aa4d5567891b.23a45fbf.abc-efg.testing&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This is how our command looks like:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh aa4d5567891b@aa4d5567891b.23a45fbf.abc-efg.testing

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Your command line might generate a warning about the authenticity of the host. This is okay as the computer is making sure you know what you are about to do. Type &lt;strong&gt;&lt;em&gt;yes&lt;/em&gt;&lt;/strong&gt; then press &lt;strong&gt;&lt;em&gt;enter&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It might look like this:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The authenticity of host 'aa4d5567891b.23a45fbf.abc-efg.testing' can't be established.
AB13407 key fingerprint is UBE457:ER7RfcOTKNlEjyEvxpkH42WDCauHx8sC31KZyD1AW4.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'aa4d5567891b.23a45fbf.abc-efg.testing' (AB13407) to the list of known hosts.
aa4d5567891b@aa4d5567891b.23a45fbf.abc-efg.testing's password:

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;At this stage you’ll be prompted to give the &lt;em&gt;&lt;strong&gt;password&lt;/strong&gt;&lt;/em&gt;, remember our password provided on the Sandbox Details up there,&lt;strong&gt;&lt;code&gt;a4567788901w2bbcc34c&lt;/code&gt;&lt;/strong&gt; that’s the one we’ll use, copy paste in and click enter!&lt;/li&gt;
&lt;li&gt;This is what it should look like:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@username:/#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;root&lt;/code&gt;&lt;/strong&gt; indicates the username of the currently logged-in user, and &lt;strong&gt;&lt;code&gt;/&lt;/code&gt;&lt;/strong&gt; represents the root directory, which is the highest level in the file system hierarchy. The &lt;strong&gt;&lt;code&gt;#&lt;/code&gt;&lt;/strong&gt; symbol indicates that the user has administrative privileges or root access, allowing them to execute commands with elevated permissions.&lt;/li&gt;
&lt;li&gt;This prompt suggests that you are in the root user's home directory &lt;strong&gt;&lt;code&gt;("/")&lt;/code&gt;&lt;/strong&gt; and have administrative privileges, indicating that you can execute commands that affect the entire system &lt;em&gt;in the virtual sandbox&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Here's ours:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@aa4d5567891b:/#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Hooray you have successfully connected to your sandbox via SSH.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Connect to the sandbox via SFTP(Secure File Transfer Protocol):
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Repeat &lt;strong&gt;Step 1&lt;/strong&gt; and &lt;strong&gt;Step 2&lt;/strong&gt; but replace the &lt;strong&gt;ssh&lt;/strong&gt; with &lt;strong&gt;sftp&lt;/strong&gt; in &lt;strong&gt;Step 3&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sftp aa4d5567891b@aa4d5567891b.23a45fbf.abc-efg.testing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Continue with &lt;strong&gt;Step 4&lt;/strong&gt; to &lt;strong&gt;Step 6&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Connect to the sandbox via the &amp;gt;_Webterm:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This is the easiest of the three steps, the Webterm enables you to use the sandbox through the web.&lt;/li&gt;
&lt;li&gt;When you click on the &lt;strong&gt;&lt;code&gt;&amp;gt;_Webterm&lt;/code&gt;&lt;/strong&gt;, it takes directly to the user's home directory.&lt;/li&gt;
&lt;li&gt;This is what you'll see
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@aa4d5567891b:/#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Now let's link it to our GitHub repo:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 0 - Create an account on GitHub [if you do not have one already]&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You will need a GitHub account for this project. If you do not already have a github.com account, you can create an account for free &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 1 - Create a Personal Access Token on Github.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To have access to your repositories and authenticate yourself, you need to create a &lt;strong&gt;Personal Access Token&lt;/strong&gt; on Github.&lt;/li&gt;
&lt;li&gt;Here's a GitHub documentation on how to &lt;a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token" rel="noopener noreferrer"&gt;Create a personal acess token&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once it’s created, you should have a token that looks like this(please note this is randomly generated):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;github_pat_r1VQ48bux6ZOLaN4p_7hH0ET9MKlJNXB5doDzYqsmRwGjSIcPC2yFfv3eitkUAxW

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please make sure you copy and store your new personal access token immediately you see it! You will not be able to see it again!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 - Create your first repository.&lt;/strong&gt;&lt;br&gt;
Inorder to link your sandbox to a repository commonly reffered to as a &lt;em&gt;'repo'&lt;/em&gt; you'll need to create a GitHub Repo.&lt;/p&gt;

&lt;p&gt;Here's an official guide on &lt;a href="https://docs.github.com/en/get-started/quickstart/create-a-repo#create-a-repository" rel="noopener noreferrer"&gt;How to create a GitHub Repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;These are the details you'll need in your repo&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: Sandbox-Git-Access-Token&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: How to connect your sandbox to your repo using GitHub access token.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Public repo&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;No &lt;strong&gt;README&lt;/strong&gt;, &lt;strong&gt;.gitignore&lt;/strong&gt;, or &lt;strong&gt;license&lt;/strong&gt;. These are optional but best practice demands to always have them in a GitHub repo.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzntkgtyrjcv28zgpqofc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzntkgtyrjcv28zgpqofc.png" alt="Sandbox-Git-Access-Token GitHub Repo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 - Open the Sandbox.&lt;/strong&gt;&lt;br&gt;
Navigate to where your sandbox details are shared and click on the &lt;code&gt;&amp;gt;_Webterm&lt;/code&gt; to open a shell terminal where you can start work from.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4 - Clone your repository.&lt;/strong&gt;&lt;br&gt;
On the webterm of the sandbox, do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clone your repository
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@aa4d5567891b:/# git clone https://{YOUR_PERSONAL_TOKEN}@github.com/{YOUR_USERNAME}/{YOUR REPO NAME}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Replace {YOUR_PERSONAL_TOKEN} with your token from step 1&lt;/p&gt;

&lt;p&gt;Replace {YOUR_USERNAME} with your GitHub username from step 0 and 1&lt;/p&gt;

&lt;p&gt;Here's how ours looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@aa4d5567891b:/# github_pat_r1VQ48bux6ZOLaN4p_7hH0ET9MKlJNXB5docPC2yFfv3eitkUAxW@@github.com/Technical-Writing-Docs/Sandbox-Git-Access-Token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5 - Update your README.md and push your modifications .&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On your Sandbox, while on the Shell terminal, navigate to your new directory.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@aa4d5567891b:/# cd Sandbox-Git-Access-Token
root@aa4d5567891b:/Sandbox-Git-Access-Token#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Update your 'README.md' file with Successfully cloned Sandbox-Git-Access-Token repo.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@aa4d5567891b:/Sandbox-Git-Access-Token# echo 'Successfully cloned Sandbox-Git-Access-Token repo.' &amp;gt;&amp;gt; README.md
root@aa4d5567891b:/Sandbox-Git-Access-Token# cat README.md
How to connect your sandbox to your repo using GitHub access token.
Successfully cloned Sandbox-Git-Access-Token repo.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Update your git identity
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@aa4d5567891b:/Sandbox-Git-Access-Token# git config --global user.email {YOUR-EMAIL@EXAMPLE.COM}
root@aa4d5567891b:/Sandbox-Git-Access-Token# git config --global user.name {YOUR GITHUB USERNAME}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Replace {&lt;a href="mailto:YOUR-EMAIL@EXAMPLE.COM"&gt;YOUR-EMAIL@EXAMPLE.COM&lt;/a&gt;} with the email address you used to create/link your GitHub account&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Replace {YOUR GITHUB USERNAME} with your GitHub username&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Commit your changes to the remote server / origin
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@aa4d5567891b:/Sandbox-Git-Access-Token# git add .
root@aa4d5567891b:/Sandbox-Git-Access-Token# git commit -m"Updated README.md and GitHub identity"
[master (root-commit) 98ag93] Updated README.md and GitHub identity
 1 file changed, 1 insertion(+)
 create mode 100644 README.md
root@aa4d5567891b:/Sandbox-Git-Access-Token# git push
Enumerating objects: 3, done.                                                                                                         
Counting objects: 100% (3/3), done.                                                                                                   
Writing objects: 100% (3/3), 212 bytes | 212.00 KiB/s, done.                                                                          
Total 3 (delta 0), reused 0 (delta 0)                                                                                                 
To https://github.com/{YOUR_USERNAME}/Sandbox-Git-Access-Token                                                                                       
 * [new branch]      master -&amp;gt; master

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good job!&lt;/p&gt;

&lt;p&gt;You have successfully created a GitHub access token, set up your sandbox and connected it to your GitHub repo.&lt;/p&gt;

&lt;p&gt;You can now check your repository on GitHub to see if everything is good.&lt;/p&gt;

</description>
      <category>shell</category>
      <category>github</category>
      <category>sandbox</category>
      <category>repo</category>
    </item>
  </channel>
</rss>
