{"id":27195270,"url":"https://github.com/tvatdci/setting-github-credentials","last_synced_at":"2026-01-20T22:36:54.208Z","repository":{"id":273592107,"uuid":"784824248","full_name":"TVATDCI/setting-github-credentials","owner":"TVATDCI","description":"Getting Started with Git and GitHub","archived":false,"fork":false,"pushed_at":"2025-01-22T19:46:06.000Z","size":7,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"new_feature","last_synced_at":"2025-04-09T19:50:07.508Z","etag":null,"topics":["git","git-workflow","github","github-collaboration","github-create-branch","github-efficientcy","github-merge","github-pull-request","github-resovle-merge-conflicts","github-step-by-step-guide-for-beginners","open-source"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TVATDCI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-10T16:19:14.000Z","updated_at":"2025-01-23T20:51:17.000Z","dependencies_parsed_at":"2025-01-21T20:43:37.412Z","dependency_job_id":null,"html_url":"https://github.com/TVATDCI/setting-github-credentials","commit_stats":null,"previous_names":["tvatdci/git_remote_extra"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TVATDCI/setting-github-credentials","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Fsetting-github-credentials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Fsetting-github-credentials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Fsetting-github-credentials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Fsetting-github-credentials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TVATDCI","download_url":"https://codeload.github.com/TVATDCI/setting-github-credentials/tar.gz/refs/heads/new_feature","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Fsetting-github-credentials/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28616995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T22:24:05.405Z","status":"ssl_error","status_checked_at":"2026-01-20T22:20:31.342Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","git-workflow","github","github-collaboration","github-create-branch","github-efficientcy","github-merge","github-pull-request","github-resovle-merge-conflicts","github-step-by-step-guide-for-beginners","open-source"],"created_at":"2025-04-09T19:45:15.627Z","updated_at":"2026-01-20T22:36:54.191Z","avatar_url":"https://github.com/TVATDCI.png","language":null,"readme":"# Getting Started with Git and GitHub/new_feature(branch)\n\nWelcome! This guide is for beginners who want to set up and start using Git and GitHub efficiently.\n\n---\n\n![Build Status](https://img.shields.io/badge/build-passing-brightgreen)\n![License](https://img.shields.io/badge/license-MIT-blue)\n\n## Table of Contents\n\n- [Getting Started with Git and GitHub/new_feature(branch)](#getting-started-with-git-and-githubnew_featurebranch)\n  - [Table of Contents](#table-of-contents)\n  - [1. Setting Up Your Git Credentials](#1-setting-up-your-git-credentials)\n  - [2. Generating and Adding an SSH Key to GitHub](#2-generating-and-adding-an-ssh-key-to-github)\n  - [3. Creating a New Repository on GitHub](#3-creating-a-new-repository-on-github)\n  - [4. Cloning an Existing Repository](#4-cloning-an-existing-repository)\n  - [5. Basic Git Workflow](#5-basic-git-workflow)\n  - [6. Common Git Commands](#6-common-git-commands)\n  - [7. Resolving Merge Conflicts](#7-resolving-merge-conflicts)\n  - [8. Why Use Git and GitHub?](#8-why-use-git-and-github)\n  - [9. Visualizing Git Workflows](#9-visualizing-git-workflows)\n  - [10. Pull Requests for Collaboration](#10-pull-requests-for-collaboration)\n    - [How to Create a Pull Request:](#how-to-create-a-pull-request)\n  - [11. Troubleshooting Common Issues](#11-troubleshooting-common-issues)\n  - [12. Git Cheat Sheet](#12-git-cheat-sheet)\n\n---\n\n## 1. Setting Up Your Git Credentials\n\nBefore you start using Git, configure your credentials to identify yourself in commits.\n\n1. **Set your GitHub username:**\n\n   ```bash\n   git config --global user.name \"YourGitHubUsername\"\n   ```\n\n2. **Set your GitHub email (must match the email used for your GitHub account):**\n\n   ```bash\n   git config --global user.email \"your@email.com\"\n   ```\n\n3. **Ensure your default branch name is `main` (important for new repositories):**\n\n   ```bash\n   git config --global init.defaultBranch main\n   ```\n\n4. **Verify your configuration:**\n\n   ```bash\n   git config --list\n   ```\n\n   Sample output:\n\n   ```bash\n   user.name=YourGitHubUsername\n   user.email=your@email.com\n   init.defaultBranch=main\n   ```\n\n---\n\n## 2. Generating and Adding an SSH Key to GitHub\n\nUsing SSH for authentication makes your workflow more secure and convenient.\n\n1. **Generate an SSH key:**\n\n   ```bash\n   ssh-keygen -t ed25519 -C \"your@email.com\"\n   ```\n\n   - When prompted, press `Enter` to accept the default location.\n   - Leave the passphrase empty for easier access.\n\n2. **Display your SSH public key:**\n\n   ```bash\n   cat ~/.ssh/id_ed25519.pub\n   ```\n\n3. **Add the SSH key to your GitHub account:**\n\n   - Go to [GitHub SSH settings](https://github.com/settings/keys).\n   - Click **\"New SSH key\"**.\n   - Paste your key and give it a meaningful title.\n   - Click **\"Add SSH key\"**.\n\n   ![New SSH Key Button](sshbutton.png)\n   ![Add SSH Key](newsshsubmit.png)\n\n4. **Test your SSH connection:**\n\n   ```bash\n   ssh -T git@github.com\n   ```\n\n   If successful, you'll see a message like:\n\n   ```bash\n   Hi username! You've successfully authenticated, but GitHub does not provide shell access.\n   ```\n\n---\n\n## 3. Creating a New Repository on GitHub\n\n1. **Create a repository on GitHub:**\n\n   - Go to [GitHub](https://github.com) and click **\"New Repository\"**.\n   - Choose a name, description, and visibility (public/private).\n   - Click **\"Create repository\"**.\n\n2. **Initialize a Git repository locally:**\n\n   ```bash\n   git init\n   ```\n\n3. **Add a remote repository:**\n\n   ```bash\n   git remote add origin git@github.com:yourusername/your-repo-name.git\n   ```\n\n4. **Add and commit files:**\n\n   ```bash\n   git add .\n   git commit -m \"Initial commit\"\n   ```\n\n5. **Push changes to GitHub:**\n\n   ```bash\n   git push -u origin main\n   ```\n\n---\n\n## 4. Cloning an Existing Repository\n\nIf you want to work on an existing project, clone it to your local machine:\n\n```bash\n   git clone git@github.com:username/repository-name.git\n```\n\nNavigate to the project directory:\n\n```bash\n   cd repository-name\n```\n\n---\n\n## 5. Basic Git Workflow\n\n1. **Check the status of your repository:**\n\n   ```bash\n   git status\n   ```\n\n2. **Stage your changes:**\n\n   ```bash\n   git add .\n   ```\n\n3. **Commit the changes with a message:**\n\n   ```bash\n   git commit -m \"Updated feature\"\n   ```\n\n4. **Push your changes to GitHub:**\n\n   ```bash\n   git push\n   ```\n\n---\n\n## 6. Common Git Commands\n\nHere are some common Git commands you might find useful:\n\n- **Check the current branch:**\n\n  ```bash\n  git branch\n  ```\n\n- **Create a new branch:**\n\n  ```bash\n  git checkout -b new-branch-name\n  ```\n\n- **Switch to an existing branch:**\n\n  ```bash\n  git checkout branch-name\n  ```\n\n- **Merge a branch into the current branch:**\n\n  ```bash\n  git merge branch-name\n  ```\n\n- **Delete a branch:**\n\n  ```bash\n  git branch -d branch-name\n  ```\n\n---\n\n## 7. Resolving Merge Conflicts\n\nMerge conflicts occur when changes from different branches conflict with each other. Here's how to resolve them:\n\n1. **Identify the files with conflicts:**\n\n   ```bash\n   git status\n   ```\n\n2. **Open the conflicted files and manually resolve the conflicts. Look for conflict markers (`\u003c\u003c\u003c\u003c\u003c\u003c\u003c`, `=======`, `\u003e\u003e\u003e\u003e\u003e\u003e\u003e`) and edit the file to resolve the conflicts.**\n\n3. **After resolving the conflicts, stage the resolved files:**\n\n   ```bash\n   git add resolved-file\n   ```\n\n4. **Commit the resolved changes:**\n\n   ```bash\n   git commit -m \"Resolved merge conflicts\"\n   ```\n\n---\n\n## 8. Why Use Git and GitHub?\n\nGit and GitHub are essential tools for managing and collaborating on projects. Here are some common use cases:\n\n- **Collaborative Coding**: Work together on the same codebase while tracking who made which changes.\n- **Open-Source Contributions**: Contribute to projects like React, Linux, or TensorFlow.\n- **Backup and Version Control**: Safeguard your code and revisit previous versions when needed.\n- **Portfolio Building**: Showcase your projects to potential employers by hosting them on GitHub.\n\n---\n\n## 9. Visualizing Git Workflows\n\nA simple branching workflow:\n\n```plaintext\nmain\n |\n |-------- feature-branch\n |                 |\n |                 |------- Bug fix\n |                 |               |\n |                 |               |----- Merge into main\n```\n\nBranches allow you to isolate features, bug fixes, or experiments from the main codebase, avoiding conflicts.\n\n---\n\n## 10. Pull Requests for Collaboration\n\nPull requests (PRs) are how developers suggest changes in a shared repository. They are great for:\n\n- Discussing changes with collaborators.\n- Reviewing code to ensure quality and consistency.\n- Merging changes into the main branch after approval.\n\n### How to Create a Pull Request:\n\n1. Push your branch to GitHub:\n\n   ```bash\n   git push origin your-branch-name\n   ```\n\n2. Go to your repository on GitHub.\n3. Click **Pull Requests** \u003e **New Pull Request**.\n4. Select the branch to merge and submit your request!\n\n---\n\n## 11. Troubleshooting Common Issues\n\n**1. SSH Key Issues**\n\n- Problem: `Permission denied (publickey)` when trying to push.\n- Solution:\n  - Ensure your SSH key is added to GitHub ([steps here](https://github.com/settings/keys)).\n  - Check if the SSH agent is running:\n    ```bash\n    eval \"$(ssh-agent -s)\"\n    ssh-add ~/.ssh/id_ed25519\n    ```\n\n**2. Conflicts During Merge**\n\n- Problem: Git shows a merge conflict after pulling changes.\n- Solution:\n  - Use `git status` to identify conflicted files.\n  - Open the conflicted files, manually resolve the conflict, then:\n    ```bash\n    git add resolved-file\n    git commit -m \"Resolved conflicts\"\n    ```\n\n---\n\n## 12. Git Cheat Sheet\n\n```plaintext\n# Basic Git Commands\ngit init                 # Initialize a new repository\ngit clone \u003curl\u003e          # Clone a repository\ngit branch               # List branches\ngit checkout -b \u003cname\u003e   # Create and switch to a new branch\ngit add .                # Stage changes\ngit commit -m \"\u003cmsg\u003e\"    # Commit changes\ngit push origin \u003cbranch\u003e # Push branch to remote\ngit pull                 # Pull latest changes\n```\n\n---\n\nCongratulations! You've successfully set up your GitHub credentials, created an SSH key, and pushed your first project to GitHub. Happy coding! 🚀\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvatdci%2Fsetting-github-credentials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftvatdci%2Fsetting-github-credentials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvatdci%2Fsetting-github-credentials/lists"}