<?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: slatzz</title>
    <description>The latest articles on DEV Community by slatzz (@slatzz).</description>
    <link>https://dev.to/slatzz</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%2F630306%2Fade786dd-3705-4721-9070-f9945195afb4.png</url>
      <title>DEV Community: slatzz</title>
      <link>https://dev.to/slatzz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/slatzz"/>
    <language>en</language>
    <item>
      <title>How To: JAVA_HOME (Mac)</title>
      <dc:creator>slatzz</dc:creator>
      <pubDate>Wed, 10 Apr 2024 06:27:27 +0000</pubDate>
      <link>https://dev.to/slatzz/how-to-javahome-mac-34l1</link>
      <guid>https://dev.to/slatzz/how-to-javahome-mac-34l1</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Check current version&lt;/li&gt;
&lt;li&gt;View all versions on machine&lt;/li&gt;
&lt;li&gt;Download a new version of Java&lt;/li&gt;
&lt;li&gt;Check JAVA_HOME&lt;/li&gt;
&lt;li&gt;
Update JAVA_HOME

&lt;ol&gt;
&lt;li&gt;Step one&lt;/li&gt;
&lt;li&gt;Step two&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Check current version
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;java -version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fix83wa3wyo16j4thcep4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fix83wa3wyo16j4thcep4.png" alt="Image description" width="800" height="77"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  View all versions on machine
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/usr/libexec/java_home -V
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvgel5marnwr55hk68hpj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvgel5marnwr55hk68hpj.png" alt="Image description" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a href="https://www.oracle.com/java/technologies/downloads/"&gt;Download a new version of Java&lt;/a&gt;
&lt;/h3&gt;




&lt;h2&gt;
  
  
  Check JAVA_HOME
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo $JAVA_HOME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Update JAVA_HOME
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step one
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export JAVA_HOME=`/usr/libexec/java_home -v X.X.X`

// Example
export JAVA_HOME=`/usr/libexec/java_home -v 20.0.02`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step two
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/.zshrc

/**
* If you don't already have JAVA_HOME defined, add it
* to this file with the path to your desired version of 
* Java. Example below:
**/

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Save your changes
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;CTRL + O (Not zero)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;ENTER&lt;/code&gt;&lt;br&gt;
&lt;code&gt;CTRL + X&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Confirm
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Confirm your file saved
nano ~/.zshrc

// Confirm Java version
java --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you for reading 🙏🏽 I hope this was helpful. ☺️&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How To: Clone Github Repo with SSH (Mac)</title>
      <dc:creator>slatzz</dc:creator>
      <pubDate>Tue, 09 Apr 2024 05:38:05 +0000</pubDate>
      <link>https://dev.to/slatzz/how-to-clone-github-repo-with-ssh-mac-37e2</link>
      <guid>https://dev.to/slatzz/how-to-clone-github-repo-with-ssh-mac-37e2</guid>
      <description>&lt;p&gt;After a year of using Bitbucket, I ran into this error when attempting to clone a Github repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cloning into 'YOUR_PROJECT'...
Username for 'https://github.com': YOUR_GITHUB_USERNAME
Password for 'https://YOUR_GITHUB_USERNAME@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/YOUR_DIRECTORY/YOUR_PROJECT.git/'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since password authentication isn't available, let's clone a repo using SSH. You will need to open:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your Github settings&lt;/li&gt;
&lt;li&gt;iTerm or preferred terminal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We begin in the terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate your SSH keys
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// cd into your .ssh folder from your home directory (~)

&amp;gt; cd
&amp;gt; cd .ssh
&amp;gt; ssh-keygen -b 4096 -t rsa

// Complete the following prompts:
Generating public/private rsa key pair.
Enter file in which to save the key
(/Users/YOUR_USER_NAME/.ssh/id_rsa): YOUR_PROJECT
// You can press ENTER for no passphrase
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in YOUR_PROJECT
Your public key has been saved in YOUR_PROJECT.pub
The key fingerprint is: ...

// Let's check your new ssh keys have been added.
// You should still be in the .ssh directory
&amp;gt; ls

// You should see your YOUR_PROJECT twice as the following:
YOUR_PROJECT
YOUR_PROJECT.pub

// To view their contents, run:
&amp;gt; cat YOUR_PROJECT
or
&amp;gt; cat YOUR_PROJECT.pub

// This is important, we will return to this in a moment.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Add your public SSH key to Github
&lt;/h2&gt;

&lt;p&gt;Now you have created your ssh keys, let's return to Github.&lt;/p&gt;

&lt;p&gt;On the right, click your profile photo &amp;gt; &lt;code&gt;Settings&lt;/code&gt; &amp;gt; &lt;code&gt;SSH and GPG Keys&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fccj6cqhq81ltqf0fg05o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fccj6cqhq81ltqf0fg05o.png" alt="Image description" width="638" height="1938"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;code&gt;New SSH Key&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwcshh41et7z4trcyxx1w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwcshh41et7z4trcyxx1w.png" alt="Image description" width="800" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1uquxbqnybdcah9de3qx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1uquxbqnybdcah9de3qx.png" alt="Image description" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Return to your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// From within your .ssh directory, run:
cat YOUR_PROJECT.pub
// This is your public ssh key. Copy it and paste in the Key box pictured above.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Title your key (it's good to title it after your project name) and click &lt;code&gt;Add SSH Key&lt;/code&gt; when you're done.&lt;/p&gt;

&lt;p&gt;Go to your repo's page and copy the link to clone with SSH. It will look something like &lt;code&gt;git@github.com:YOUR_DIRECTORY/YOUR_PROJECT.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Go back to your terminal. We are almost done!&lt;/p&gt;

&lt;h2&gt;
  
  
  Clone your repo
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// You are probably still in your .ssh directory. You will want to now go into the directory into which you want to clone your repo. 
&amp;gt; cd
&amp;gt; cd YOUR_TARGET_DIRECTORY
&amp;gt; ssh-add ~/.ssh/YOUR_PROJECT
Identity added: /Users/YOUR_USER_NAME/.ssh/YOUR_PROJECT
&amp;gt; git clone git@github.com:YOUR_DIRECTORY/YOUR_PROJECT.git
Cloning into 'YOUR_PROJECT'...
remote: Enumerating objects: 67837, done.
remote: Counting objects: 100% (358/358), done.
remote: Compressing objects: 100% (194/194), done.
remote: Total 67837 (delta 226), reused 262 (delta 163), pack-reused 67479
Receiving objects: 100% (67837/67837), 33.61 MiB | 19.82 MiB/s, done.
Resolving deltas: 100% (53811/53811), done.
// Yay! 


## Heads up
///////////////////////////////////////////
// Note! If at any point you get this message:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

// Run the following again inside YOUR_TARGET_DIRECTORY
&amp;gt; ssh-add ~/.ssh/YOUR_PROJECT
// Make sure you see this:
Identity added: /Users/YOUR_USER_NAME/.ssh/YOUR_PROJECT

// Then try to clone or run project again.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading! I hope this was helpful! 🎉&lt;/p&gt;

</description>
      <category>github</category>
      <category>ssh</category>
      <category>macbook</category>
    </item>
  </channel>
</rss>
