Skip to content

Commit 9e302ad

Browse files
authored
Merge pull request github#30454 from github/meowius-locally-hosted-upload
Update Git init command for uploading locally hosted code to work with earlier versions
2 parents b84b627 + 3afbf9d commit 9e302ad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

content/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ If you have existing source code or repositories stored locally on your computer
6666
$ git init -b main
6767
```
6868

69-
If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git branch -m`.
69+
If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git symbolic-ref HEAD refs/heads/main`.
7070

7171
``` shell
72-
$ git init && git branch -m main
72+
$ git init && git symbolic-ref HEAD refs/heads/main
7373
```
7474
5. Add the files in your new local repository. This stages them for the first commit.
7575

@@ -113,10 +113,10 @@ If you have existing source code or repositories stored locally on your computer
113113
$ git init -b main
114114
```
115115

116-
If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git branch -m`.
116+
If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git symbolic-ref HEAD refs/heads/main`.
117117

118118
``` shell
119-
$ git init && git branch -m main
119+
$ git init && git symbolic-ref HEAD refs/heads/main
120120
```
121121
5. Add the files in your new local repository. This stages them for the first commit.
122122
```shell
@@ -159,10 +159,10 @@ If you have existing source code or repositories stored locally on your computer
159159
$ git init -b main
160160
```
161161

162-
If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git branch -m`.
162+
If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git symbolic-ref HEAD refs/heads/main`.
163163

164164
``` shell
165-
$ git init && git branch -m main
165+
$ git init && git symbolic-ref HEAD refs/heads/main
166166
```
167167
5. Add the files in your new local repository. This stages them for the first commit.
168168
```shell

0 commit comments

Comments
 (0)