To Create a GitHub Repository
- Go to https://github.com/ and login (or sign up).
- Once you're logged in, you should see a button to make "+ New Repository" somewhere on the page (at the time of writing this, it is in the right sidebar). Click "+ New Repository."
- Name your repository and give it a description if you'd like. Choose to make the repository public (unless you pay to make it private). For the sake of having something to pull in this example, I will check the "Initialize this repository with a README" box.
- Click "Create repository."
To Clone a GitHub Repository with SourceTree
- Open SourceTree and click the "Clone/New" button on the top left.
- Enter the URL to the GitHub repository you want to clone. Select the local folder you'd like to store the cloned repository in, and enter a name for the project or repository you're cloning (you only need to enter a name if you're bookmarking the repository and the name will only show up in SourceTree).
- Click "Clone."
- Once the cloning process is done, you can navigate to the local folder you chose and see the files from the GitHub repository there.
To Push Changes to GitHub from SourceTree
Now, anytime something inside that local folder is changed (such as file creation, file deletion, or file modification), SourceTree will recognize it and give you the option to push (keep/save) those changes.
- Add a new file to the local folder (or make any other change in that folder).
- Open SourceTree and wait for it to recognize a change has been made.
- Checkmark the changes in "Unstaged files" that you want to push (they then move to the "Staged files" box). In some files, if multiple changes have occurred in those files, you can stage and unstage specific "hunks" of changes.
- Once you have everything that you want pushed to the GitHub repository marked as "staged," Enter a commit comment at the bottom of the window.
- If you want the changes to immediately affect the repository on GitHub, you can check the box that says "Push changes immediately to origin/master." (You may not want to check this box if you're pushing changes every few minutes, just because it takes longer to connect to GitHub and upload the changes. If you choose not to check that, then your commits will still be saved to your computer and uploaded to GitHub the next time you push changes to GitHub). When you're ready, press "Commit."
Done!
Now when you refresh your repository on GitHub, the changes you made on your computer will be reflected online.
No comments:
Post a Comment
I like feedback, so if you liked what you read or even if you didn't like it, but have some suggestions for me, I'd like to hear them. If you found it boring or found it cool, let me know. If you have a suggestion for something you'd like to see on here, just leave a comment.
You can also email me at michaelzicc44@gmail.com.