Github에서 토큰 발급하기
GitHub에서 토큰을 발급받는 방법에 대해 알아보세요! 안전하게 깃허브를 사용하는 방법을 배우고, 토큰을 발급받을 수 있어요.
Feb 07, 2024
Github 회원가입
깃허브에서 회원가입을 하고 Github 계정을 생성해 주세요.
Token 발급받기
로컬 터미널에서 Git을 이용할 때 비밀번호 대신 사용할 Token을 발급받을거에요.
1️⃣ 오른쪽 상단 프로필을 누르면 나오는 바에서 [Settings]을 선택해 주세요.![Settings](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252Fd7606317-37f6-49e2-9532-df927accb0d5%252F%2525E1%252584%252589%2525E1%252585%2525B3%2525E1%252584%25258F%2525E1%252585%2525B3%2525E1%252584%252585%2525E1%252585%2525B5%2525E1%252586%2525AB%2525E1%252584%252589%2525E1%252585%2525A3%2525E1%252586%2525BA_2024-02-06_%2525E1%252584%25258B%2525E1%252585%2525A9%2525E1%252584%252592%2525E1%252585%2525AE_9.35.20.png%3Ftable%3Dblock%26id%3D3b3f0548-5b31-4896-ad15-456a864cfbb7%26cache%3Dv2&w=3840&q=75)
Settings
![Settings](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252Fd7606317-37f6-49e2-9532-df927accb0d5%252F%2525E1%252584%252589%2525E1%252585%2525B3%2525E1%252584%25258F%2525E1%252585%2525B3%2525E1%252584%252585%2525E1%252585%2525B5%2525E1%252586%2525AB%2525E1%252584%252589%2525E1%252585%2525A3%2525E1%252586%2525BA_2024-02-06_%2525E1%252584%25258B%2525E1%252585%2525A9%2525E1%252584%252592%2525E1%252585%2525AE_9.35.20.png%3Ftable%3Dblock%26id%3D3b3f0548-5b31-4896-ad15-456a864cfbb7%26cache%3Dv2&w=3840&q=75)
2️⃣ [Settings] 가장 아래에 있는 [Developer settings] 메뉴를 클릭합니다.![Developer settings](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252F87cb40ba-0cc1-4ce8-8d8d-20c7d91950c0%252F2.png%3Ftable%3Dblock%26id%3D357592af-26db-40ff-9a16-6822b6dfdd4e%26cache%3Dv2&w=3840&q=75)
Developer settings
![Developer settings](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252F87cb40ba-0cc1-4ce8-8d8d-20c7d91950c0%252F2.png%3Ftable%3Dblock%26id%3D357592af-26db-40ff-9a16-6822b6dfdd4e%26cache%3Dv2&w=3840&q=75)
3️⃣ [Personal access tokens] - [Tokens (classic)]을 선택해 주세요. ![Generate new token(classic)](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252Fbe8dde2a-3885-4167-bd47-d3340d568b52%252F3.png%3Ftable%3Dblock%26id%3Da266a75f-7d3d-4de6-a065-4b6a6c3bbd5f%26cache%3Dv2&w=3840&q=75)
Generate new token(classic)
[Generate new token(classic)]
버튼을 클릭해 새로운 토큰을 생성해 주세요.![Generate new token(classic)](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252Fbe8dde2a-3885-4167-bd47-d3340d568b52%252F3.png%3Ftable%3Dblock%26id%3Da266a75f-7d3d-4de6-a065-4b6a6c3bbd5f%26cache%3Dv2&w=3840&q=75)
4️⃣ 토큰 정보 입력하기![토큰 정보 입력하기](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252Fdf8aed6e-e56f-45ef-885a-ba79b544f357%252F4.png%3Ftable%3Dblock%26id%3D561b8332-3894-48f5-8c2c-a5b8f140b258%26cache%3Dv2&w=3840&q=75)
토큰 정보 입력하기
토큰에 대한 정보(이름, 만료 기간 등)를 입력하고, 필요한 권한(scope)을 선택합니다.
특히, 코드를 push 하거나 레포지토리를 읽기 위한 권한은 필수!로 선택해 주세요.
(기본적으로 토큰의 유효기간은 30일이지만, 작성자는 90일로 설정했어요.)
![토큰 정보 입력하기](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252Fdf8aed6e-e56f-45ef-885a-ba79b544f357%252F4.png%3Ftable%3Dblock%26id%3D561b8332-3894-48f5-8c2c-a5b8f140b258%26cache%3Dv2&w=3840&q=75)
5️⃣ [Generate token] 버튼을 누르면 토큰이 생성돼요!![Generate token](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252F83278215-f620-4f14-aeef-9e78079933c6%252F5.png%3Ftable%3Dblock%26id%3D0dcc0bf3-f21d-4626-b95f-f3dabda88d43%26cache%3Dv2&w=3840&q=75)
Generate token
![Generate token](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252F83278215-f620-4f14-aeef-9e78079933c6%252F5.png%3Ftable%3Dblock%26id%3D0dcc0bf3-f21d-4626-b95f-f3dabda88d43%26cache%3Dv2&w=3840&q=75)
6️⃣ 아래 사진과 같이 토큰이 발급되었어요.![발급된 토큰 확인하기](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252F4bbc1a37-e963-4b0b-ae78-4e9dce8badda%252F6.png%3Ftable%3Dblock%26id%3Dab688b56-9517-471c-b715-e3c5a4ed5071%26cache%3Dv2&w=3840&q=75)
발급된 토큰 확인하기
생성된 토큰은 보안상의 이유로 한 번만 표시되므로, 꼭 토큰을 안전한 곳에 복사해두세요. 토큰은 애플리케이션에서 인증에 사용돼요.
![발급된 토큰 확인하기](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252F4bbc1a37-e963-4b0b-ae78-4e9dce8badda%252F6.png%3Ftable%3Dblock%26id%3Dab688b56-9517-471c-b715-e3c5a4ed5071%26cache%3Dv2&w=3840&q=75)
발급된 토큰은 화면을 나가면 다시 확인할 수 없으며, 토큰 기반 인증은 토큰이 생성된 이후에는 토큰 값을 알아낼 방법이 없어요. 따라서 토큰을 잃어버리지 않도록 주의가 필요하며, 토큰을 복사한 후에는 개인이 관리하는 안전한 곳에 저장해야 해요!
토큰이 필요한 대상을 미리 파악하고 안전하게 보관하는 것이 중요해요. 토큰이 유출되거나 보안에 위협이 되는 경우에는 즉시 새로운 토큰으로 교체해 주세요.
7️⃣ 다시 [Tokens (classic)] 페이지로 돌아가면 내가 생성한 토큰 설명과 설정을 볼 수 있어요.![[Tokens (classic)]에서 토큰 값은 다시 확인할 수 없음](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252Fbed202e9-be08-454f-875c-9b8aef4cf54a%252F7.png%3Ftable%3Dblock%26id%3Df87d1d5b-0fbf-4301-83c3-b104905a32ef%26cache%3Dv2&w=3840&q=75)
[Tokens (classic)]에서 토큰 값은 다시 확인할 수 없음
토큰 값은 다시 확인할 수 없다는 점..꼭 유의해주세요😉
![[Tokens (classic)]에서 토큰 값은 다시 확인할 수 없음](https://inblog.ai/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252Fa29b669d-e680-438e-b18c-08888fc54a21%252Fbed202e9-be08-454f-875c-9b8aef4cf54a%252F7.png%3Ftable%3Dblock%26id%3Df87d1d5b-0fbf-4301-83c3-b104905a32ef%26cache%3Dv2&w=3840&q=75)
terminal 에서 Token 사용하기
git clone 또는 git push 명령 시, Password 로 발급받은 토큰을 입력하면 돼요!
git push origin main // 클론 받을 때 Username for 'https://github.com':'사용자 이름' Password for 'https://SprintSample@github.com': '발급 받은 토큰'
🔽 아래에서 뉴스레터를 구독하고, IT커리어 팁을 쉽게 받아 보세요!
Share article