-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathgit-fork.1
123 lines (117 loc) · 2.44 KB
/
git-fork.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-FORK" "1" "October 2017" "" "Git Extras"
.
.SH "NAME"
\fBgit\-fork\fR \- Fork a repo on github
.
.SH "SYNOPSIS"
\fBgit\-fork\fR [<github\-repo\-url>]
.
.SH "DESCRIPTION"
If a github repo url is given, fork the repo\. Like clone but forks first\.
.
.IP "1." 4
forks the repo on github
.
.IP "2." 4
clones the repo into the current dir
.
.IP "3." 4
adds the original repo as a remote called \fBupstream\fR
.
.IP "" 0
.
.P
If a url is not given and the current dir is a github repo, fork the repo\.
.
.IP "1." 4
forks the current repo
.
.IP "2." 4
rename the \fBorigin\fR remote repo to \fBupstream\fR
.
.IP "3." 4
adds the forked repo as a remote called \fBorigin\fR
.
.IP "" 0
.
.P
Remotes will use ssh if you have it configured with GitHub, if not, https will be used\.
.
Create a fork a project on GitHub via command line\.
.
.P
A personal access token is required for making the API call to create a new fork in GitHub\. API Documentation here \fIhttps://docs\.github\.com/en/rest/reference/repos#forks\fR
.
.P
Make sure the personal access token has the right \fBOAuth\fR scopes for the repo(s)
.
.P
Use \fBGITHUB_TOKEN\fR environment variable, or \fBgit config \-\-global \-\-add git\-extras\.github\-personal\-access\-token <your\-personal\-access\-token>\fR
.
.P
If using multiple accounts, override the global value in the specific repo using \fBgit config git\-extras\.github\-personal\-access\-token <other\-acc\-personal\-access\-token>\fR
.
.SH "EXAMPLE"
Fork expect\.js:
.
.IP "" 4
.
.nf
$ git fork https://github\.com/LearnBoost/expect\.js
.
.fi
.
.IP "" 0
.
.P
or just:
.
.IP "" 4
.
.nf
$ git fork LearnBoost/expect\.js
.
.fi
.
.IP "" 0
.
.P
Then:
.
.IP "" 4
.
.nf
$ \.\.<forks into your github profile and clones repo locally to expect\.js dir>\.\.\.
$ cd expect\.js && git remote \-v
origin git@github\.com:<user>/expect\.js (fetch)
origin git@github\.com:<user>/expect\.js (push)
upstream git@github\.com:LearnBoost/expect\.js (fetch)
upstream git@github\.com:LearnBoost/expect\.js (push)
.
.fi
.
.IP "" 0
.
.P
If the current dir is a clone of expect\.js, this has the same effect:
.
.IP "" 4
.
.nf
$ git fork
.
.fi
.
.IP "" 0
.
.SH "AUTHOR"
Written by Andrew Griffiths <\fImail@andrewgriffithsonline\.com\fR>
.
.SH "REPORTING BUGS"
<\fIhttps://github\.com/tj/git\-extras/issues\fR>
.
.SH "SEE ALSO"
<\fIhttps://github\.com/tj/git\-extras\fR>