1GH-AUTH-LOGIN(1) GitHub CLI manual GH-AUTH-LOGIN(1)
2
3
4
6 gh-auth-login - Authenticate with a GitHub host
7
8
9
11 gh auth login [flags]
12
13
14
16 Authenticate with a GitHub host.
17
18
19 The default authentication mode is a web-based browser flow. After com‐
20 pletion, an authentication token will be stored internally.
21
22
23 Alternatively, use --with-token to pass in a token on standard input.
24 The minimum required scopes for the token are: "repo", "read:org".
25
26
27 Alternatively, gh will use the authentication token found in environ‐
28 ment variables. This method is most suitable for "headless" use of gh
29 such as in automation. See gh help environment for more info.
30
31
32 To use gh in GitHub Actions, add GH_TOKEN: ${{ github.token }} to
33 "env".
34
35
36
38 -p, --git-protocol <string>
39 The protocol to use for git operations: {ssh|https}
40
41
42 -h, --hostname <string>
43 The hostname of the GitHub instance to authenticate with
44
45
46 -s, --scopes <strings>
47 Additional authentication scopes to request
48
49
50 -w, --web
51 Open a browser to authenticate
52
53
54 --with-token
55 Read token from standard input
56
57
58
60 # start interactive setup
61 $ gh auth login
62
63 # authenticate against github.com by reading the token from a file
64 $ gh auth login --with-token < mytoken.txt
65
66 # authenticate with a specific GitHub instance
67 $ gh auth login --hostname enterprise.internal
68
69
70
71
72
74 gh-auth(1)
75
76
77
78 Jan 2023 GH-AUTH-LOGIN(1)