๐Ÿ’ป Programming

[Git] ๊ฐœ์ธํ”„๋กœ์ ํŠธ ์ฒ˜์Œ ์‹œ์ž‘์‹œ github ๊ด€๋ จ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•

์ผ€์ด์น˜ 2024. 7. 2. 17:35

์˜ค๋žœ๋งŒ์— ๊ฐœ์ธ ํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘ํ–ˆ๋Š”๋ฐ ์‰ฌ๋Š” ํ…€์ด  ๊ธธ๋‹ค๋ณด๋‹ˆ ๋งค๋ฒˆ ์‹œ์ž‘ํ• ๋•Œ๋งˆ๋‹ค git ๊ด€๋ จ ์˜ค๋ฅ˜๋•Œ๋ฌธ์— ๊ตฌ๊ธ€๋งํ•˜๋Š” ์‹œ๊ฐ„์ด ์•„๊นŒ์›Œ ๊ธฐ๋ก์šฉ์œผ๋กœ ๋‚จ๊น๋‹ˆ๋‹ค.

 

์†Œ์Šค ์ฝ”๋“œ ์ž‘์„ฑํ•˜๊ณ  ์ด๋Ÿฐ์ €๋Ÿฐ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๊ณ  github repo ์ƒ์„ฑํ›„์— push ํ•˜๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ 

% git init

% git remote add origin {github url}

% git push --set-upstream origin main
Password for 'https://aaaaaa@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/aaaaaa/test.git/'

 

์ด๋ ‡๊ฒŒ ์—๋Ÿฌ๊ฐ€ ๋‚œ๋‹ค๋ฉด Password ๋ž€์— Personal Access Token(PAT) ๊ฐ’์„ ๋„ฃ์–ด์ฃผ๋ฉด ๋จ.

PAT ๋Š” github๊ณ„์ •์„ค์ • (repo ์„ค์ • ์•„๋‹˜) > Developer Settings > Personal access tokens (classic) ์—์„œ ๋ฐœ๊ธ‰๋ฐ›์„ ์ˆ˜ ์žˆ์Œ.

 

 

๊ทธ๋ฆฌ๊ณ  ๋ธŒ๋žœ์น˜ ์ด์Šˆ๋กœ ์•„๋ž˜์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค๋ฉด..

 % git checkout main
branch 'main' set up to track 'origin/main'.
Switched to a new branch 'main'
% git merge prod
fatal: refusing to merge unrelated histories

 

% git merge prod --allow-unrelated-histories

์ด ๋ช…๋ น์–ด๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Œ