Where to store the personal access token from GitHub?

后端 未结 5 1276
难免孤独
难免孤独 2021-01-30 02:45

Is it necessary to store the personal access token somewhere locally on the machine after generating it in GitHub?

If yes, is there any preferred way where it could be

5条回答
  •  北海茫月
    2021-01-30 03:42

    Basically I did this on my machine:

    https://gist.github.com/bsara/5c4d90db3016814a3d2fe38d314f9c23

    My profile script is slightly different than described:

    env=~/.ssh/agent.env
    
    agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
    
    agent_start () {
        (umask 077; ssh-agent >| "$env")
            . "$env" >| /dev/null ; 
    }
    
    agent_load_env
    
    # agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
    agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
    
    if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
        agent_start
        ssh-add
    elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
        ssh-add
    fi
    
    unset env
    

提交回复
热议问题