Changes

Jump to navigation Jump to search
1,110 bytes added ,  22:37, 22 May 2023
no edit summary
Line 2: Line 2:     
== <u>The Setup</u> ==
 
== <u>The Setup</u> ==
  −
Create a new repository: Once you're logged in, click on the "+" sign at the top-right corner of the GitHub homepage and select "New repository." Give your repository a name and optionally provide a description.
  −
  −
Choose repository settings: On the new repository page, you can customize various settings. You can make the repository public or private, add a license, initialize it with a README file, and choose other options as per your preference.
  −
  −
Clone the repository: After creating the repository, you'll want to clone it to your local machine. To do this, you'll need to have Git installed on your computer. Open a terminal or command prompt and navigate to the directory where you want to store your code. Then, run the following command:
   
<ol>
 
<ol>
   <li>Sign up for a GitHub account by going to the [https://github.com/ GitHub website] and create a new account.</li>
+
   <li>Sign up for a GitHub account by going to the [https://github.com/ GitHub website] and create a new account.</li><br>
 
   <li>Once you're logged in, click on the "+" sign at the top-right corner of the GitHub homepage and select "New repository" to create a new repository. Give your repository a name and provide a description.</li>
 
   <li>Once you're logged in, click on the "+" sign at the top-right corner of the GitHub homepage and select "New repository" to create a new repository. Give your repository a name and provide a description.</li>
 
     <ul>
 
     <ul>
Line 19: Line 13:  
           <li>License (optional) - MIT License is well known and least restrictive</li>
 
           <li>License (optional) - MIT License is well known and least restrictive</li>
 
           <li>You can add a README file</li>
 
           <li>You can add a README file</li>
           <li>And more ...</li>
+
          <li>You can also rename the main branch (this must be done before the repository is created, changing the name will change all subsequent repositories that are made in the future)</li>
 +
           <li>And more ...</li><br>
 
         </ul>
 
         </ul>
 
     </ul>
 
     </ul>
Line 31: Line 26:  
           <li>For the Fine-grained token you will need to select which permissions you'd like to allow (not sure about the classic token)</li>
 
           <li>For the Fine-grained token you will need to select which permissions you'd like to allow (not sure about the classic token)</li>
 
           <li>Select a period for the token to be valid, upto 90 days maximum (I believe)</li>
 
           <li>Select a period for the token to be valid, upto 90 days maximum (I believe)</li>
           <li>Once complete it will provide you with the token you can copy, this will be used in place of your password later</li>
+
           <li>Once complete it will provide you with the token you can copy, this will be used in place of your password later</li><br>
 
         </ul>
 
         </ul>
 
     </ul>
 
     </ul>
Line 40: Line 35:  
           <li>You can do the same for your home computer, you'll just need to open a terminal or command prompt and navigate to the directory where you want to store your code</li>
 
           <li>You can do the same for your home computer, you'll just need to open a terminal or command prompt and navigate to the directory where you want to store your code</li>
 
         </ul>
 
         </ul>
       <li>Type the command: <i><b>git clone https://github.com/your-username/your-repository.git</b></i> where you'll replace "your-username" with your GitHub username and "your-repository" with the name of your repository.</li>
+
       <li><u>Type the command:</u><br> <b>git clone https&#58;&#47;&#47;github&#46;com&#47;your-username&#47;your-repository&#46;git</b><br> <i>make sure to replace "your-username" with your GitHub username and "your-repository" with the name of your repository</i></li>
 +
      <li>You will now need to login. Use your <b>GitHub Username</b>, but make sure to use the <b>Personal Access Token</b> you created earlier and <b><u>NOT</u></b> your GitHub password</li>
 +
    </ul>
   −
 
+
  <li>At this point you should have a new folder in your annex with the name of your GitHub repository</li>
       <li>Then on the left select "Personal access tokens"</li>
+
    <ul>
       <li>Select "Fine-grained tokens" or "Tokens (classic)", I did the prior one</li>
+
       <li>Confirm that the remote repository is correctly added, use the command:<br> <b>git remote -v</b><br></li>
        <ul>
+
       <li>If needed, you can link the local repository to the remote repository using:<br> <b>git remote add origin &lt;repository-url&gt;</b><br></li>
          <li>For the Fine-grained token you will need to select which permissions you'd like to allow (not sure about the classic token)</li>
+
    </ul><br>
          <li>Select a period for the token to be valid, upto 90 days maximum (I believe)</li>
+
  <li>To switch to or determine a branch in Git, you can use the git checkout command:
          <li>Once complete it will provide you with the token you can copy, this will be used in place of your password later</li>
+
    <ul>
        </ul>
+
      <li>Determine the name of the branch you want to switch to via:<br> <b>git branch</b><br> It will show all branches available and indicate your current branch with a * <br></li>
 +
      <li>Create a new branch using: <br> <b>git branch new-branch-name</b> then use <b>git checkout new-branch-name</b> to switch to that branch and work in it<br> OR <br> <b>git checkout -b new-branch-name</b> will create and switch to the new branch in one step<br></li>
 
     </ul>
 
     </ul>
 
+
  <li>Add files/folders to your directory</li>
 
+
  <li>When you're ready to save, make sure you are in the root directory of your repository or the directory where the new folder you want to save is located. Then use the git add command to add the new folder and its contents to the staging area. Run the following command:<br> <b>git add folder-name</b><br> OR <br> <b>git add .</b> <br>  If you want to add all new files and folders in the current directory<br></li>
 
+
  <li>Once the new folder/file is added to the staging area, you can commit the changes using the git commit command:<br> <b>git commit -m "Commit message"</b> <br> Replace "Commit message" with a descriptive message summarizing the changes you made.<br></li>
 
+
  <li>After committing the changes (on your local machine), you can push them to the remote repository on GitHub using the git push command:<br> <b>git push origin branch-name</b><br> Replace <i>branch-name</i> with the name of the branch you want to push to (e.g., main).<br></li>
 
  −
 
  −
 
   
</ol>
 
</ol>
581

edits

Navigation menu