Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.



From August 13, 2021, GitHub is no longer accepting account passwords when authenticating Git operations, and will show the message below when you are trying to use methods before.

-----------------------------------------------------------------

Git Message 

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

-----------------------------------------------------------------

Instead, you need to add PAT (Personal Access Token). 


First, you need to generate a PAT on GitHub following the steps below:

  • Settings => Developer Settings => Personal access tokens => Generate a personal access token => Fill the form => click Generate token => copy the generated token, which is something like "ghp_***"
Second, clone or set remote url with PAT
  • git clone https://<username>:<githubtoken>@github.com/<username>/<repositoryname>.git
  • git remote set-url origin https://<username>:<githubtoken>@github.com/<username>/<repositoryname>.git

How to use proxy for git command, sudo apt, in Ubuntu



Set proxy for svn
Configure in your ~/.subversion/servers
[global]
        http-proxy-host = 127.0.0.1
        http-proxy-port = 3128

Set proxy for git
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port


Or configure these globally in your user ~/.gitconfig file, e.g.,
[http]
         proxy = http://xxx.xxx.xxx.xxx:8000


Show current configuration
git config --global --get-regexp http.*
git config --global --list
git config --local --list


Unset proxy

git config --unset http.proxy




Set proxy for apt

sudo nano /etc/apt/apt.conf


add proxy settings, e.g.,

Acquire::http::proxy "http://proxy_username:password@proxy_ip:port";
Acquire::https::proxy "https://proxy_username:password@proxy_ip:port";
Acquire::ftp::proxy "ftp://proxy_username:password@proxy_ip:port";





Ubuntu set proxy

export http_proxy="http://PROXY_SERVER:PORT"
export https_proxy="https://PROXY_SERVER:PORT"
export ftp_proxy="http://PROXY_SERVER:PORT"


Unset
unset http_proxy
unset https_proxy
unset ftp_proxy


Install snap packages behind web proxy on Ubuntu
sudo snap set system proxy.http="http://<proxy_addr>:<proxy_port>"
sudo snap set system proxy.https="http://<proxy_addr>:<proxy_port>"

자주 쓰는 git command 모음



// 현재 git 상황
git status

// 새로운 repo시작
git init [repository name]

// (github) 등에 있는 repo 복사
git clone [url]

// branch바꾸기
git checkout [branch name]
git checkout -b [branch name] // 새 branch생성후 사용

// branch통합
git merge [branch name]

// 파일(들)을 staging 영역에 추가
git add [file]
git add *

// 파일 삭제 및 삭제를 stage영역에 추가
git rm [file]

// stage안된 파일 다른점 비교
git diff
git diff –staged // stage영역 파일과 최신 버전 비교

// 파일을 stage영역에서 제거
git reset [file]

// 파일을 repo로 commit
git commit -m “[ Type in the commit message]”

// 로컬 파일변경된 myfile.ext를 무시하고 hard reset, @ 는 HEAD 대표함
git checkout @ -- myfile.ext
git pull

// 전체 repo를 hard reset할 경우 (모든 파일의 로컬 변경을 무시)
git checkout HEAD
git pull

// remote repo에 변경사항을 보냄
git push [variable name] master