You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _sessions/c1s2/2_pushing_to_github.md
+53-6Lines changed: 53 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -14,18 +14,65 @@ There are several ways of getting GitHub to publish your site as a GitHub page.
14
14
15
15
### Pushing code up to github
16
16
17
-
To push code up to GitHub, in the GitHub app select the 'Push to Github' button (on the top right). You'll be prompted to choose a name (which might as well be `first_site`).
17
+
Go to github, login, and click "Create New Repo" in the top left hand corner.
18
+
19
+

20
+
21
+
Follow the instructions, calling it something like `first_site`. **Do not** click the box which says 'Create a readme with this repository'. You'll get to a page when it'll describe how to get your code online. You want to follow the instructions for "Pushing an existing repository to github".
22
+
18
23
19
24
{% exercise %}
20
25
1. Log in to GitHub and check you've verified your email address.
21
-
1. In the 'Branches' panel of the GitHub app, change the name of the current branch from `master` to `gh-pages`.
22
-
2. Click the 'Push to Github' button in the GitHub app.
26
+
2. Change the name of your master branch to 'gh-pages'.
27
+
3. On github create a new repository called 'first_site'.
28
+
4. Push your code up to github.
23
29
3. On Github check you can see your `first_site` code.
24
30
4. On the code page on github, click on Settings. It should tell you (about half way down) the url where they've published your site. Have a look to see whether you can see it!
25
-
5. (If you finish early) Make a change to `index.html` in Sublime Text. Commit the change to the repository and then push it to GitHub. Make sure you can see the change in the code on GitHub and also in the published page.
31
+
5. (If you finish early) Make a change to `index.html` in Sublime Text. Add and commit the change to the repository and then push it to GitHub. Make sure you can see the change in the code on GitHub and also in the published page.
26
32
{% endexercise %}
27
33
28
-
### Creating a git repository, adding and committing with Source Tree
34
+
### Git with source tree
35
+
36
+
#### Change the branch name to 'gh-pages'
37
+
38
+
1. Go to the branches section on the right hand side.
39
+
2. Right-click on the name and select 'rename'.
40
+
41
+
#### Pushing to github for the first time
42
+
43
+
1. In the 'Repository' menu, click 'Add remote'.
44
+
2. Copy the git url (from the bottom right) on github, and copy it into the source tree 'URL/path' box.
45
+
46
+
#### Pushing for a second time
47
+
48
+
### Git with the command line
49
+
50
+
#### Change the branch name to 'gh-pages'
51
+
52
+
1. Using the command line, navigate to the repository folder.
53
+
2. Run the command:
54
+
55
+
git branch -m gh-pages
56
+
57
+
3. To check this worked, run the command:
58
+
59
+
git branch -a
60
+
61
+
#### Pushing to github for the first time
62
+
63
+
We're assiming here that you've just created your repository and are on the github new repository screen.
64
+
65
+

66
+
67
+
If you've set up ssh keys, go for the ssh option, if not, go for https. You should end up doing something like:
You might now be prompted to add your github username and password (if you're doing the https method). If all goes well, when you go to github you should see the `first_site` folder containing your html file.
0 commit comments