<?xml version="1.0"?>
<rss version="2.0"><channel><title>Git Repo Guides Latest Topics</title><link>https://gguclan.com/forums/forum/212-git-repo-guides/</link><description>Git Repo Guides Latest Topics</description><language>en</language><item><title>Git Repository - General Guide</title><link>https://gguclan.com/forums/topic/587-git-repository-general-guide/</link><description><![CDATA[<p style="text-align:center">
	<strong><span style="font-size:24px"><span style="color:#ffb300">GGU Git Repository - General Guide</span></span></strong><br>
	<span style="color:#ff6600"><span style="font-size:12px">This post is continuously being updated as methods/information changes, this can happen without any warning. Last update 1/22/25. Last Bot Update 1/22/25.</span></span>
</p>

<p>
	This is a comprehensive guide for those who don't mind reading a wall of text, this guide cover everything from Generating an SSH key, Adding an SSH key to your <span ipsnoautolink="true">GGU Git Repository Account, Verifying an SSH key and other Git processes such as Initializing a repository, Adding Files, Pushing, Pulling, Committing, Creating/Removing Branches and Troubleshooting. If you have any question, please contact us on our Discord server under #helpdesk.</span>
</p>

<p>
	<span style="font-size:18px;"><strong><span style="color:#ffb300">Generating a New SSH Key</span></strong></span>
</p>

<p>
	You can generate a new SSH key on your local machine. After you generate the key, you can add the public key to your account on git.gguclan.com to enable authentication for Git operations over SSH. 
</p>

<p>
	<strong><span style="color:#2ecc71;">Windows:</span></strong>
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Windows</span>
	</div>

	<div class="ipsSpoiler_contents ipsClearfix" data-gramm="false">
		<ol>
			<li>
				Install and open Git Bash (<a href="https://git-scm.com/downloads" ipsnoembed="true" rel="external nofollow">https://git-scm.com/downloads</a> - Select Windows)
			</li>
			<li>
				Paste the text below, replacing the email used in the example with your GGU Git Repository email address. 
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2555_9" style=""><span class="pln">ssh-keygen -t ed25519 -C "your_ggu_git_repo_email@example.com"</span></pre>

				<p>
					This creates a new SSH key, using the provided email as a label.<br>
					When you're prompted to "Enter a file in which to save the key", you can press Enter to accept the default file location. Please note that if you created SSH keys previously, ssh-keygen may ask you to rewrite another key, in which case we recommend creating a custom-named SSH key. To do so, type the default file location and replace id_ALGORITHM with your custom key name (ssh_keyname). IF YOU ENTER A CUSTOM KEY NAME, CHECK "C:\Users\YOU\ssh_keyname". 
				</p>

				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2555_22" style=""><span class="pln">&gt; Enter file in which to save the key (/c/Users/YOU/.ssh/id_ALGORITHM or ssh_keyname):[Press enter]</span></pre>
			</li>
			<li>
				At the prompt, type a secure passphrase.
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2555_14" style=""><span class="pln">&gt; Enter passphrase (empty for no passphrase*): [Type a passphrase]
&gt; Enter same passphrase again: [Type passphrase again]
*Passphrase is required for the GGU Git Repository</span></pre>
			</li>
			<li>
				You should see this in the console if you did everything correctly:
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_4897_4" style=""><span class="pln">Your identification has been saved in ssh_keyname
Your public key has been saved in ssh_keyname.pub
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
The key's randomart image is:
+--[ED25519 256]--+
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
+----[SHA256]-----+</span></pre>
			</li>
		</ol>
	</div>
</div>

<p>
	<span style="font-size:18px;"><strong><span style="color:#ffb300">Adding your SSH key to the ssh-agent</span></strong></span>
</p>

<p>
	Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.
</p>

<p>
	<strong><span style="color:#2ecc71;">Windows:</span></strong>
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Windows</span>
	</div>

	<div class="ipsSpoiler_contents ipsClearfix" data-gramm="false">
		<ol>
			<li>
				In a new admin elevated PowerShell window, ensure the ssh-agent is running. You can start it manually by using the command:
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2961_6" style=""><span class="pln">Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent</span></pre>
			</li>
			<li>
				In a terminal window without elevated permissions, add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace ssh_keyname in the command with the name of your private key file (no file extension).
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_6590_5" style=""><span class="pln">ssh-add C:\Users\YOU\.ssh\ssh_keyname</span></pre>
			</li>
			<li>
				Add the SSH public key to your account on GGU Git Repository. For more information, see GGU Git Repository Account - Add a New SSH Key to your account.
			</li>
		</ol>
	</div>
</div>

<p>
	<span style="font-size:18px"><strong><span style="color:#ffb300">Adding a new SSH key to your account</span></strong></span>
</p>

<p>
	You can add an SSH key and use it for authentication, or commit signing, or both.
</p>

<ol>
	<li>
		Copy the SSH public key (.pub extension) to your clipboard <br>
		<br>
		If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_8925_11" style=""><span class="pln">Go to c/Users/YOU/.ssh/ or c/Users/YOU/ and locate the newly generated SSH key (ssh_keyname.pub) and copy the contents (Ctrl + C) - Make sure to open with notepad</span></pre>
	</li>
	<li>
		In the upper right-hand corner of the GGU Git Repository, click on your profile picture and go to Settings.
	</li>
	<li>
		Navigate using the left-hand menu to SSH / GPG Keys
	</li>
	<li>
		When on that page you'll see 2 options - Manage SSH keys and Manage GPG Keys. Select "Add Key" next to Manage SSH Keys.
	</li>
	<li>
		From there you'll need to enter a "Key Name", This can be anything that is easily identifiable in case you use multiple keys.
	</li>
	<li>
		Paste the information you copied from ssh_keyname.pub and paste under "Content" and click "Add Key". 
	</li>
</ol>

<p>
	<span style="font-size:18px"><strong><span style="color:#ffb300">Verifying a newly added SSH key</span></strong></span>
</p>

<p>
	Now we have to verify the SSH key that you just added before we can start using it. 
</p>

<ol>
	<li>
		Click "Verify"
	</li>
	<li>
		Follow the instructions given by the Git Repository for Linux or use the command below for Windows using Git Bash - Enter your passphrase when prompted. Replace token with the token provided by the Git Repository. 
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_6883_4" style=""><span class="pln">echo -n 'token' | ssh-keygen -Y sign -n gitea -f "C:\Users\YOU\.ssh\ssh_keyname" or "C:\Users\YOU\ssh_keyname"</span></pre>
	</li>
	<li>
		You should now see:
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_8925_13" style=""><span class="pln">-----BEGIN SSH SIGNATURE-----
LOTS OF TEXT
-----END SSH SIGNATURE-----</span></pre>
	</li>
	<li>
		Copy the SSH Signature and paste it into the Git Repository. 
	</li>
	<li>
		If the process was completed correctly, you should see "SSH key "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" has been verified." and should show "Verified Key" above the key name you provided.
	</li>
</ol>

<p>
	<font color="#ffb300"><span style="font-size: 18px;"><b>Creating/Initializing a Repository</b></span></font>
</p>

<p>
	Now that we our SSH key generated and added to our account, we can start getting to work.
</p>

<ol>
	<li>
		Create a new repository on the GGU Git Repository webpage by going under the organization (Development) and clicking "New Repository".
	</li>
	<li>
		Give the new Repository a name using underscores or dashes for spaces (Good repository names use short, memorable and unique keywords.) and set a Description.
	</li>
	<li>
		You should now see some instructions; from this point you'll want to create a directory for your repository on your computer "C:\Users\YOU\project_name" or anywhere of your choice.
	</li>
	<li>
		Now navigate to the repository path on your computer and right click in a blank area and select "Open Git Bash Here".
	</li>
	<li>
		When the Git Bash comes up, Enter:
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2961_8" style=""><span class="pln">git init</span></pre>
		This will initialize the directory you've selected as a directory Git can use; you should see a .git folder be created if you have "View hidden folders" turned on as confirmation.<br>
		 
	</li>
	<li>
		Now enter
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2961_10" style=""><span class="pln">git checkout -b main</span></pre>
	</li>
	<li>
		Enter
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2961_12" style=""><span class="pln">git add README.md</span></pre>
		This will create a README file in the repository directory and add the file to the push que.<br>
		 
	</li>
	<li>
		Enter
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_8465_4" style=""><span class="pln">git commit -m "First Commit"</span></pre>
		This will tell Git that you are ready to commit the changes to the repository and the reason for the commit.<br>
		 
	</li>
	<li>
		Enter
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_1263_4" style=""><span class="pln">git remote add origin ssh://server_info_from_git_repo/organization_name(Development)/repository_name.git</span></pre>
		Check your repository for the full path under the SSH option.  HTTPS will not work properly and should not be used.<br>
		 
	</li>
	<li>
		Type in your passphrase when prompted - Note Git may ask if you want to trust ssh://server_info_from_git_repo/ with the server's footprint, type YES.<br>
		 
	</li>
	<li>
		Enter
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2961_21" style=""><span class="pln">git push -u origin main

Enter passphrase when prompted</span></pre>
		This will push the changes to the GGU Git Repository. <br>
		 
	</li>
	<li>
		You can check the repository via the webpage to confirm the changes were made or you can use #dev-git-changes on discord.
	</li>
</ol>

<p>
	<font color="#ffb300"><span style="font-size: 18px;"><b>General Git Commands</b></span></font>
</p>

<p>
	Now that we've created and initialized a Repository we can start running normal Git commands, these will vary for the projects you're working on - These are the general commands. If you can't figure out how to use a command, Git Bash does a pretty good job of explaining why something isn't working properly. 
</p>

<p>
	<strong><span style="color:#2ecc71;">Start a working area (see also: git help tutorial)</span></strong>
</p>

<ul>
	<li>
		clone - Clone a repository into a new directory.
	</li>
	<li>
		init - Create an empty Git repository or reinitialize an existing one.
	</li>
</ul>

<p>
	<strong><span style="color:#2ecc71;">Work on the current change (see also: git help everyday)</span></strong>
</p>

<ul>
	<li>
		add - Add file contents to the index.
	</li>
	<li>
		mv - Move or rename a file, a directory, or a symlink.
	</li>
	<li>
		restore - Restore working tree files.
	</li>
	<li>
		rm - Remove files from the working tree and from the index.
	</li>
</ul>

<p>
	<strong><span style="color:#2ecc71;">Examine the history and state (see also: git help revisions)</span></strong>
</p>

<ul>
	<li>
		bisect - Use binary search to find the commit that introduced a bug.
	</li>
	<li>
		diff - Show changes between commits, commit and working tree, etc.
	</li>
	<li>
		grep - Print lines matching a pattern.
	</li>
	<li>
		log - Show commit logs.
	</li>
	<li>
		show - Show various types of objects.
	</li>
	<li>
		status - Show the working tree status.
	</li>
</ul>

<p>
	<span style="color:#2ecc71;"><strong>Grow, mark and tweak your common history</strong></span>
</p>

<ul>
	<li>
		branch - List, create, or delete branches.
	</li>
	<li>
		commit - Record changes to the repository.
	</li>
	<li>
		merge - Join two or more development histories together.
	</li>
	<li>
		rebase - Reapply commits on top of another base tip.
	</li>
	<li>
		reset - Reset current HEAD to the specified state.
	</li>
	<li>
		switch - Switch branches.
	</li>
	<li>
		tag - Create, list, delete or verify a tag object signed with GPG.
	</li>
</ul>

<p>
	<strong><span style="color:#2ecc71;">Collaborate (see also: git help workflows)</span></strong>
</p>

<ul>
	<li>
		fetch - Download objects and refs from another repository.
	</li>
	<li>
		pull - Fetch from and integrate with another repository or a local branch.
	</li>
	<li>
		push - Update remote refs along with associated objects.
	</li>
</ul>

<p>
	<strong><span style="color:#2ecc71;">Change git remote origin</span></strong>
</p>

<ul>
	<li>
		remote -v - View current remote origin.
	</li>
	<li>
		remote set-url origin &lt;NEW_GIT_URL_HERE&gt; - Change to a new remote origin.
	</li>
</ul>

<p>
	<font color="#ffb300"><span style="font-size: 18px;"><b>Troubleshooting</b></span></font>
</p>

<p>
	These are general problems that you may encounter and how to solve them. 
</p>

<ol>
	<li>
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2961_25" style=""><span class="pln">fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin main

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.</span></pre>
	</li>
</ol>
]]></description><guid isPermaLink="false">587</guid><pubDate>Thu, 23 Jan 2025 03:11:41 +0000</pubDate></item><item><title>Git Repository Account - Add a New SSH Key to your account</title><link>https://gguclan.com/forums/topic/586-git-repository-account-add-a-new-ssh-key-to-your-account/</link><description><![CDATA[<p style="text-align:center">
	<strong><span style="font-size:24px"><span style="color:#ffb300">GGU Git Repository Account - Add a New SSH Key to your account</span></span></strong><br>
	<span style="color:#ff6600"><span style="font-size:12px">This post is continuously being updated as methods/information changes, this can happen without any warning. Last update 1/22/25. Last Bot Update 1/22/25.</span></span>
</p>

<p>
	This guide is to help you add a newly generated SSH key to your GGU Git Repository Account. If you need help generating a new SSH key and adding it to the ssh-agent, please visit the <strong><a href="https://gguclan.com/forums/topic/585-ggu-git-repository-account-generate-a-new-ssh-key/" rel=""><span style="color:#f1c40f;">GGU Git Repository Account - Generate a New SSH Key Guide</span></a></strong>, if you have any questions, please go through our discord under #helpdesk. 
</p>

<p>
	<span style="font-size:18px"><strong><span style="color:#ffb300">Adding a new SSH key to your account</span></strong></span>
</p>

<p>
	You can add an SSH key and use it for authentication, or commit signing, or both.
</p>

<ol>
	<li>
		Copy the SSH public key (.pub extension) to your clipboard <br>
		<br>
		If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_8925_11" style=""><span class="pln">Go to c/Users/YOU/.ssh/ or c/Users/YOU/ and locate the newly generated SSH key (ssh_keyname.pub) and copy the contents (Ctrl + C) - Make sure to open with notepad</span></pre>
	</li>
	<li>
		In the upper right-hand corner of the GGU Git Repository, click on your profile picture and go to Settings.
	</li>
	<li>
		Navigate using the left-hand menu to SSH / GPG Keys
	</li>
	<li>
		When on that page you'll see 2 options - Manage SSH keys and Manage GPG Keys. Select "Add Key" next to Manage SSH Keys.
	</li>
	<li>
		From there you'll need to enter a "Key Name", This can be anything that is easily identifiable in case you use multiple keys.
	</li>
	<li>
		Paste the information you copied from ssh_keyname.pub and paste under "Content" and click "Add Key". 
	</li>
</ol>

<p>
	<span style="font-size:18px"><strong><span style="color:#ffb300">Verifying a newly added SSH key</span></strong></span>
</p>

<p>
	Now we have to verify the SSH key that you just added before we can start using it. 
</p>

<ol>
	<li>
		Click "Verify"
	</li>
	<li>
		Follow the instructions given by the Git Repository for Linux or use the command below for Windows using Git Bash - Enter your passphrase when prompted. Replace token with the token provided by the Git Repository. 
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_6883_4" style=""><span class="pln">echo -n 'token' | ssh-keygen -Y sign -n gitea -f "C:\Users\YOU\.ssh\ssh_keyname" or "C:\Users\YOU\ssh_keyname"</span></pre>
	</li>
	<li>
		You should now see:
		<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_8925_13" style=""><span class="pln">-----BEGIN SSH SIGNATURE-----
LOTS OF TEXT
-----END SSH SIGNATURE-----</span></pre>
	</li>
	<li>
		Copy the SSH Signature and paste it into the Git Repository. 
	</li>
	<li>
		If the process was completed correctly, you should see "SSH key "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" has been verified." and should show "Verified Key" above the key name you provided.
	</li>
</ol>
]]></description><guid isPermaLink="false">586</guid><pubDate>Thu, 23 Jan 2025 01:47:35 +0000</pubDate></item><item><title>Git Repository Account - Generate a New SSH Key</title><link>https://gguclan.com/forums/topic/585-git-repository-account-generate-a-new-ssh-key/</link><description><![CDATA[<p style="text-align:center">
	<strong><span style="font-size:24px"><span style="color:#ffb300">GGU Git Repository Account - Generate a New SSH Key</span></span></strong><br>
	<span style="color:#ff6600"><span style="font-size:12px">This post is continuously being updated as methods/information changes, this can happen without any warning. Last update 1/22/25. Last Bot Update 1/22/25.</span></span>
</p>

<p>
	These are the instructions for generating a new SSH key, adding the newly generated SSH key to the ssh-agent and adding the ssh key to your GGU Git Repository Account. If you have any questions, please use #helpdesk on our discord server. 
</p>

<p>
	<span style="font-size:18px;"><strong><span style="color:#ffb300">Generating a New SSH Key</span></strong></span>
</p>

<p>
	You can generate a new SSH key on your local machine. After you generate the key, you can add the public key to your account on git.gguclan.com to enable authentication for Git operations over SSH.
</p>

<p>
	<strong><span style="color:#2ecc71;">Windows:</span></strong>
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Windows</span>
	</div>

	<div class="ipsSpoiler_contents ipsClearfix" data-gramm="false">
		<ol>
			<li>
				Install and open Git Bash (<a href="https://git-scm.com/downloads" ipsnoembed="true" rel="external nofollow">https://git-scm.com/downloads</a> - Select Windows)
			</li>
			<li>
				Paste the text below, replacing the email used in the example with your GGU Git Repository email address. 
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2555_9" style=""><span class="pln">ssh-keygen -t ed25519 -C "your_ggu_git_repo_email@example.com"</span></pre>

				<p>
					This creates a new SSH key, using the provided email as a label.<br>
					When you're prompted to "Enter a file in which to save the key", you can press Enter to accept the default file location. Please note that if you created SSH keys previously, ssh-keygen may ask you to rewrite another key, in which case we recommend creating a custom-named SSH key. To do so, type the default file location and replace id_ALGORITHM with your custom key name (ssh_keyname). IF YOU ENTER A CUSTOM KEY NAME, CHECK "C:\Users\YOU\ssh_keyname". 
				</p>

				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2555_22" style=""><span class="pln">&gt; Enter file in which to save the key (/c/Users/YOU/.ssh/id_ALGORITHM or ssh_keyname):[Press enter]</span></pre>
			</li>
			<li>
				At the prompt, type a secure passphrase.
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2555_14" style=""><span class="pln">&gt; Enter passphrase (empty for no passphrase*): [Type a passphrase]
&gt; Enter same passphrase again: [Type passphrase again]
*Passphrase is required for the GGU Git Repository</span></pre>
			</li>
			<li>
				You should see this in the console if you did everything correctly:
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_4897_4" style=""><span class="pln">Your identification has been saved in ssh_keyname
Your public key has been saved in ssh_keyname.pub
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
The key's randomart image is:
+--[ED25519 256]--+
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
+----[SHA256]-----+</span></pre>
			</li>
		</ol>
	</div>
</div>

<p>
	<span style="font-size:18px;"><strong><span style="color:#ffb300">Adding your SSH key to the ssh-agent</span></strong></span>
</p>

<p>
	Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.
</p>

<p>
	<strong><span style="color:#2ecc71;">Windows:</span></strong>
</p>

<div class="ipsSpoiler" data-ipsspoiler="">
	<div class="ipsSpoiler_header">
		<span>Windows</span>
	</div>

	<div class="ipsSpoiler_contents ipsClearfix" data-gramm="false">
		<ol>
			<li>
				In a new admin elevated PowerShell window, ensure the ssh-agent is running. You can start it manually by using the command:
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_2555_16" style=""><span class="pln"># start the ssh-agent in the background
Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent</span></pre>
			</li>
			<li>
				In a terminal window without elevated permissions, add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace ssh_keyname in the command with the name of your private key file (no file extension).
				<pre class="ipsCode prettyprint lang-html prettyprinted" id="ips_uid_6590_5" style=""><span class="pln">ssh-add C:\Users\YOU\.ssh\ssh_keyname</span></pre>
			</li>
			<li>
				Add the SSH public key to your account on GGU Git Repository. For more information, see GGU Git Repository Account - Add a New SSH Key to your account.
			</li>
		</ol>
	</div>
</div>
]]></description><guid isPermaLink="false">585</guid><pubDate>Thu, 23 Jan 2025 00:50:23 +0000</pubDate></item></channel></rss>
