Skip to content

Instantly share code, notes, and snippets.

@QasimTalkin
Last active June 20, 2023 21:32
Show Gist options
  • Select an option

  • Save QasimTalkin/394790ae3c8dbe8506faea5640587664 to your computer and use it in GitHub Desktop.

Select an option

Save QasimTalkin/394790ae3c8dbe8506faea5640587664 to your computer and use it in GitHub Desktop.
πŸ“ **Code Sharing and Management with GitHub**

πŸ“ Code Sharing and Management with GitHub

πŸ–₯️ For Windows:

  1. Launch your preferred web browser.

  2. Visit GitHub.

  3. In this class, we will be sharing code using repositories on GitHub.

  4. Click on the "New" button to create a new repository.

  5. Give the new repository the name W3-Schools-Day-1.

  6. Enable the "Add a README file" option by selecting "Add README".

  7. Click on the "Create repository" button.

  8. Now that the remote repository is created, we need to clone it to our local machine to make changes.

  9. Click on the "Code" button and select the "HTTPS" option to copy the repository URL.

  10. (If you havent instlled git bash alredy) Once the repository is created, you can download and install Git for Windows by visiting Git for Windows and following the installation instructions.

  11. After Git is installed, you can open "Git Bash" from the Start menu. This will provide you with a terminal-like interface where you can execute Git commands.

  12. In the Git Bash terminal, use the cd command to navigate to the directory where you want to locate the repository. For example:

    • πŸ”‘ Use the cd command to navigate to the directory where you want to locate the repository. For example:

      cd Desktop
    • πŸ”‘ Use the git clone command followed by the copied URL from GitHub to clone the repository to your machine. For example:

      git clone <url>
    • πŸ”‘ The git clone command creates a new directory with the same name as the repository. Use cd to navigate into the new directory. For example:

      cd W3-Schools-Day-1
    • πŸ”‘ Use the touch command to add files to your local repository as required by the W3 Schools assignment.

      touch index.html
      touch style.css
      touch script.js
    • πŸ”‘ Use git add -A to add all the changes to your repository.

      git add -A
    • πŸ”‘ To commit your changes, use git commit -m followed by a commit message. For example:

      git commit -m "Add initial files"
    • πŸ”‘ Use git push origin main to push your changes back to the GitHub repository.

      git push origin main
    • πŸ”‘ It is important to keep your local repository up-to-date. To pull down any changes from the GitHub repository and update your local repository, use git pull origin main. The "origin" refers to the cloned repository, and "main" is the default branch.

      git pull origin main

🍎 For Mac:

  1. Launch your preferred web browser.

  2. Visit GitHub.

  3. In this class, we will be sharing code using repositories on GitHub.

  4. Click on the "New" button to create a new repository.

  5. Give the new repository the name W3-Schools-Day-1.

  6. Enable the "Add a README file" option by selecting "Add README".

  7. Click on the "Create repository" button.

  8. Now that the remote repository is created, we need to clone it to our local machine to make changes.

  9. Click on the "Code" button and select the "HTTPS" option to copy the repository URL.

  10. Open the terminal on your Mac.

    • πŸ”‘ Use the cd command to navigate to the directory where you want to locate the repository. For example:

      cd Desktop
    • πŸ”‘ Use the git clone command followed by the copied URL from GitHub to clone the repository to your machine. For example:

      git clone <url>
      
      
    • πŸ”‘ The git clone command creates a new directory with the same name as the repository. Use cd to navigate into the new directory. For example:

      cd W3-Schools-Day-1
    • πŸ”‘ Use the touch command to add files to your local repository as required by the W3 Schools assignment.

      touch index.html
      touch style.css
      touch script.js
    • πŸ”‘ Use git add -A to add all the changes to your repository.

      git add -A
    • πŸ”‘ To commit your changes, use git commit -m followed by a commit message. For example:

      git commit -m "Add initial files"
    • πŸ”‘ Use git push origin main to push your changes back to the GitHub repository.

      git push origin main
    • πŸ”‘ It is important to keep your local repository up-to-date. To pull down any changes from the GitHub repository and update your local repository, use git pull origin main. The "origin" refers to the cloned repository, and "main" is the default branch.

      git pull origin main
@Jault1
Copy link

Jault1 commented Jun 20, 2023

Thanks Abul. This was VERY helpful!
-- John A.

@JohnCaptiv8
Copy link

Thanks very much Abul. We will be speaking soon. Instructions are great. My slight issue at the moment seems to be around permissions in Git Bash. Once that is sorted I will be able to complete this task.

@QasimTalkin
Copy link
Author

QasimTalkin commented Jun 20, 2023

Hi @JohnCaptiv8, this could be to do with the folder you are in, make sure you are not in a cloud folder and you are inside a folder or destination that is on your local computer. Feel free to reach out with any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment