PageSourceSearch

https://app.learngit.io/component---src-pages-templates-lesson-js-…-19-e-51-a-25-c-mdx-f93a8a5cab4a1980db82.js

js learngit.io collected 2026-09-28 06:59:52 UTC 13,082 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunklearn_git=self.webpackChunklearn_git||[]).push([[9852],{17673:function(e,t,n){n.r(t),n.d(t,{Head:function(){return I},default:function(){return P}});var l=n(98587),a=n(21585),s=n.n(a),r=n(58156),o=n.n(r),i=n(62193),c=n.n(i),u=n(28453),m=n(96540);function d(e){const t=Object.assign({h2:"h2",p:"p",h3:"h3",strong:"strong",pre:"pre",code:"code",a:"a",ul:"ul",li:"li"},(0,u.RP)(),e.components);return m.createElement(m.Fragment,null,m.createElement(t.h2,{id:"what-is-ssh"},"What is SSH?"),"\n",m.createElement(t.p,null,"SSH is a network protocol that provides secure communication between computers. Instead of relying on usernames and passwords for authentication, SSH uses a pair of encryption keys. These two keys (a public and private key) operate in tandem to authenticate, and encrypt network communication."),"\n",m.createElement(t.h2,{id:"ssh-and-git"},"SSH and Git"),"\n",m.createElement(t.p,null,"Most professional developers use the SSH protocol to connect to Git repositories stored on remote servers. The first step to using SSH is generating an SSH keypair on your workstation. After a keypair is generated, the public key should be shared with your hosting service. Below are instructions for generating SSH keypairs on macOS/Linux and Windows. After generating a keypair, find the instructions for the particular hosting service you're using to finalize the setup process."),"\n",m.createElement(t.h2,{id:"generate-ssh-keys"},"Generate SSH keys"),"\n",m.createElement(t.h3,{id:"macoslinux"},"macOS/Linux"),"\n",m.createElement(t.p,null,m.createElement(t.strong,null,"1. Open a terminal window")),"\n",m.createElement(t.p,null,m.createElement(t.strong,null,"2. Generate an SSH keypair")),"\n",m.createElement(t.pre,null,m.createElement(t.code,null,"ssh-keygen -t ed25519\n")),"\n",m.createElement(t.p,null,"The utility will prompt you to provide or accept the default storage location for the keys. By default the keys are stored in the hidden ",m.createElement(t.code,null,".ssh")," folder located in your home directory."),"\n",m.createElement(t.p,null,"The key files are named ",m.createElement(t.code,null,"id_ed25519"),"; however, if you've generated SSH keys previously, provide a new filename at this stage. Note: the filename you choose doesn't affect the functionality of the keys themselves."),"\n",m.createElement(t.p,null,m.createElement(t.strong,null,"3. Copy the public key to your clipboard")),"\n",m.createElement(t.p,null,"Navigate to the location of the key files, by default:"),"\n",m.createElement(t.pre,null,m.createElement(t.code,null,"cd ~/.ssh\n")),"\n",m.createElement(t.p,null,"Display the public key in the terminal:"),"\n",m.createElement(t.pre,null,m.createElement(t.code,null,"cat id_ed25519.pub\n")),"\n",m.createElement(t.p,null,"Copy the public key and continue to the setup instructions for the particular hosting service you're using."),"\n",m.createElement(t.h3,{id:"windows"},"Windows"),"\n",m.createElement(t.p,null,m.createElement(t.strong,null,"1. Open a command prompt window")),"\n",m.createElement(t.p,null,"Open the start menu by hitting the Windows key. Type ",m.createElement(t.code,null,"cmd"),', and open the "Command Prompt" application'),"\n",m.createElement(t.p,null,m.createElement(t.strong,null,"2. Generate an SSH keypair")),"\n",m.createElement(t.pre,null,m.createElement(t.code,null,"ssh-keygen -t ed25519\n")),"\n",m.createElement(t.p,null,"The utility will prompt you to provide or accept the default storage location for the keys. By default the keys are stored in the hidden ",m.createElement(t.code,null,".ssh")," folder located in your home directory."),"\n",m.createElement(t.p,null,"The key files are named ",m.createElement(t.code,null,"id_ed25519"),"; however, if you've generated SSH keys previously, provide a new filename at this stage. Note: the filename you choose doesn't affect the functionality of the keys themselves."),"\n",m.createElement(t.p,null,m.createElement(t.strong,null,"3. Copy the public key to your clipboard")),"\n",m.createElement(t.p,null,"Navigate to the location of the key files, by default:"),"\n",m.createElement(t.pre,null,m.createElement(t.code,null,"cd C:\\Users\\username/.ssh\n")),"\n",m.createElement(t.p,null,"Display the public key in the command prompt:"),"\n",m.createElement(t.pre,null,m.createElement(t.code,null,"more id_ed25519.pub\n")),"\n",m.createElement(t.p,null,"Copy the public key and continue to the setup instructions for the particular hosting service you're using."),"\n",m.createElement(t.h2,{id:"ssh-passphrases"}
1,"SSH Passphrases"),"\n",m.createElement(t.p,null,"If you chose to create your SSH key with a passphrase, follow ",m.createElement(t.a,{href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases"},"these instructions")," for additional configuration options."),"\n",m.createElement(t.h2,{id:"hosting-service-config"},"Hosting Service Config"),"\n",m.createElement(t.p,null,"The process for sharing your public key is unique for each hosting service. Select your particular hosting service from the list below for setup instructions. If the hosting service you're using is not listed, contact [email protected] to have it added."),"\n",m.createElement(t.ul,null,"\n",m.createElement(t.li,null,m.createElement(t.a,{href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account"},"GitHub")),"\n",m.createElement(t.li,null,m.createElement(t.a,{href:"https://docs.gitlab.com/ee/user/ssh.html#add-an-ssh-key-to-your-gitlab-account"},"GitLab")),"\n",m.createElement(t.li,null,m.createElement(t.a,{href:"https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-windows/#Provide-Bitbucket-Cloud-with-your-public-key"},"BitBucket")),"\n",m.createElement(t.li,null,m.createElement(t.a,{href:"https://learn.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops#step-2-add-the-public-key-to-azure-devops"},"Azure Repos")),"\n",m.createElement(t.li,null,m.createElement(t.a,{href:"https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html#setting-up-ssh-unixes-keys"},"AWS CodeCommit")," (start at step 3.3)"),"\n"),"\n",m.createElement(t.h2,{id:"ide-config"},"IDE Config"),"\n",m.createElement(t.p,null,"It can be convenient to take advantage of your IDE's native Git integration for certain tasks. Below are setup instructions for the most popular tools. If you don't see yours listed, contact [email protected] to have it added."),"\n",m.createElement(t.ul,null,"\n",m.createElement(t.li,null,m.createElement(t.a,{href:"jetbrains.com/help/space/git-keys-and-passwords.html"},"JetBrains")),"\n"))}var p=function(e){void 0===e&&(e={});const t=Object.assign({},(0,u.RP)(),e.components).wrapper;return t?m.createElement(t,e,m.createElement(d,e)):d(e)},h=n(24794),E=n(3529),g=n(74423),y=n(2125),f=n(4907),v=n(23191),k=n(54755),b=n(79479),w=n(66452),S=n(18726),N=n(82358),x=n(64238),A=n(69478),H=n(8762),T=n(16304),_=n(39796),C=n(18565);const z=["data","children"];function L(e){let t=e.data,n=e.children;(0,l.A)(e,z);const a=(0,g.As)(),s=a.user,r=a.isLoading,i=o()(t,"contentfulLesson"),u=o()(i,"quiz"),d=o()(i,"exercise"),p=o()(i,"body.body"),h=o()(i,"module[0]"),y=o()(h,"course[0]"),v=o()(h,"draft",!0),T=o()(i,"video"),L=o()(T,"vid")?atob(T.vid):null,I=o()(i,"visualizations"),P=!!T&&!v,F=!c()(I),G=H.M.filter((e=>"read"===e.id||"watch"===e.id&&P||"explore"===e.id&&F)),W=(0,m.useState)(P?"watch":G[0].id),j=W[0],q=W[1],R="watch"===j&&P,M="explore"===j&&F,D=!R&&!M,Q=(0,m.useState)({[P?"watch":G[0].id]:!0,read:!0}),J=Q[0],U=Q[1],Z=(0,C.y)(o()(h,"id"),o()(y,"modules")),$=Z.next_module,Y=Z.previous_module,K=(0,C.u)(i.id,o()(h,"lessons"),$,Y),V=K.next_lesson,X=K.previous_lesson,ee=!!V&&o()($,"lessons[0].id")===V.id,te=o()(ee?$:h,"plans")||[],ne=!r&&!(0,g.w)(te,s);return m.createElement(E.A,{currentPageObject:i,plansWithAccessByUid:o()(h,"plans")||[],contentMaxWidth:u&&!T?840:void 0},m.createElement("header",{style:{marginBottom:"var(--s-6)"}},h&&h.title&&m.createElement("div",{className:"eyebrow",style:{color:"var(--brand-deep)"}},h.title),m.createElement("div",{className:"ds-cluster ds-cluster--between ds-cluster--wrap ds-gap-4",style:{marginTop:"var(--s-2)"}},m.createElement("div",{className:"ds-cluster ds-gap-3"},m.createElement("h1",{className:"h1"},i.title),d&&m.createElement(_.m_,{placement:"bottom"},m.createElement(_.k$,null,m.createElement("span",{className:"stat-pill stat-pill--reward",style:{cursor:"help",textTransform:"uppercase",letterSpacing:"0.5px"}},"Beta")),m.createElement(_.ZI,null,"Please report issues using the thumbs up/down icons below."))),m.createElement("div",{className:"ds-cluster ds-gap-3"},m.createElement(f.A,{slug:o()(i,"slug",""),readOnly:!(!u&&!d),readOnlyHint:d?"Complete all goals to mark complete":void 0,variant:"header"}),m.createElement(B,{slug:o()(i,"slug",""),next_lesson:V,locked:ne}))),u&&!T&&m.createElement("p",{className:"lead",style:{marginTop:"var(--s-3)"}},"Test your knowledge!"),d&&!T&&m.createElement("p",{className:"lead",style:{marginTop:"var(--s-3)"}},"Your turn — type commands to complete the exercise.")),d?m.createElement(m.Fragment,null,m.createElement(A.A,{exercise:d,lessonSlug:o()(i,"slug","")}),!v&&p?m.createElement("div",{className:"content",style:{marginTop:"var(--s-8)"}},n):null):m.createElement(m.Fragment,null,G.length>1?m.createElement("div",{className:"lesson-mode-switcher",style:{marginBottom:"var(--s-6)"}},m.createElement(H.A,{tabs:G,active:j,onChange:e=>{U((t=>t[e]?t:Object.assign({},t,{[e]:!0}))),q(e)}})):m.createElement(m.Fragment),P&&(J.watch||R)?m.createElement("div",{className:"lesson-video-header",style:{display:R?void 0:"none"}},"vimeo"===T.hostingPlatform?m.createElement(k.A,{videoId:L,borderRadius:"8px",shadow:!0}
1):m.createElement(N.A,{videoId:L,borderRadius:"8px",shadow:!0})):m.createElement(m.Fragment),F&&(J.explore||M)?m.createElement("div",{style:{display:M?void 0:"none"}},m.createElement(x.A,{visualizations:I})):m.createElement(m.Fragment),J.read||D?m.createElement("div",{style:{display:D?void 0:"none"}},m.createElement(b.A,{content:p}),m.createElement("div",{className:"content"},v?m.createElement("p",null,m.createElement("strong",null,"Lesson not found."),m.createElement("br"),"If you suspect this to be in error, please submit a help request."):n,u?m.createElement(m.Fragment,null,m.createElement(w.A,{title:"Quiz",questions:u.questionsJson.questions,lessonSlug:o()(i,"slug","")})):m.createElement(m.Fragment))):m.createElement(m.Fragment)),m.createElement("div",{style:{marginTop:"var(--s-8)",marginBottom:"var(--s-4)"}},m.createElement(f.A,{slug:o()(i,"slug",""),readOnly:!(!u&&!d),readOnlyHint:d?"Complete all goals to mark complete":void 0})),m.createElement(O,{previous_lesson:X,next_lesson:V,nextLocked:ne}),m.createElement("div",{className:"ds-cluster ds-cluster--center ds-gap-3",style:{marginTop:"var(--s-9)",color:"var(--muted)",fontSize:"var(--fs-small)"}},m.createElement("span",null,"Was this lesson helpful?"),m.createElement(S.A)))}const B=e=>{let t=e.slug,n=e.next_lesson,l=e.locked,a=void 0!==l&&l;const r=(0,v.p)(),i=r.data,c=r.isPending,u=o()(n,"fields.path"),d=s()(i,t)>=0,p=(0,m.useState)(!1),E=p[0],g=p[1],y=(0,m.useRef)({slug:null,complete:null});if((0,m.useEffect)((()=>{if(c)return;const e=y.current;y.current={slug:t,complete:d},e.slug===t&&!1===e.complete&&d&&g(!0)}),[t,d,c]),!u||!d)return null;const f=m.createElement(h.Link,{to:u,className:"btn btn-primary btn-sm btn-nudge lesson-next"+(E?" lesson-next--enter":""),"aria-label":"Next lesson: "+n.title,onAnimationEnd:()=>g(!1)},a?m.createElement(T.LM,{size:12}):null,m.createElement("span",null,"Next"),m.createElement(T.Qp,{size:16}));return a?m.createElement(_.m_,null,m.createElement(_.k$,{asChild:!0},f),m.createElement(_.ZI,{className:"Tooltip"},"The next module is part of a paid plan")):f},O=e=>{let t=e.previous_lesson,n=e.next_lesson,l=e.nextLocked,a=void 0!==l&&l;const s=o()(t,"fields.path"),r=o()(n,"fields.path"),i=t&&s,c=n&&r;return i||c?m.createElement("nav",{className:"lesson-pager","aria-label":"Lesson navigation"},i?m.createElement(h.Link,{to:s,className:"lesson-pager-btn lift"},m.createElement("span",{className:"eyebrow lesson-pager-dir"},m.createElement(T.nk,{size:14})," Previous"),m.createElement("span",{className:"lesson-pager-title"},t.title)):m.createElement("span",{className:"lesson-pager-spacer"}),c?m.createElement(h.Link,{to:r,className:"lesson-pager-btn lesson-pager-btn--next lift"},m.createElement("span",{className:"eyebrow lesson-pager-dir"},"Next ",a&&m.createElement("span",{className:"lesson-pager-lock"},m.createElement(T.LM,{size:12})," Paid")," ",m.createElement(T.Qp,{size:14})),m.createElement("span",{className:"lesson-pager-title"},n.title)):m.createElement("span",{className:"lesson-pager-spacer"})):null},I=e=>{let t=e.data;return m.createElement(y.A,{title:o()(t,"contentfulLesson.title")})};function P(e){return m.createElement(L,e,m.createElement(p,e))}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.