Connect GitHub Repository

If you have disconnected from GitHub and need to reconnect, you'll need to follow the reconnection process. You can check whether the connection has been disconnected through the link.


Creating a GitHub Repository

(This article does not involve the method via a mirror.)

If you've disconnected a previously linked GitHub repository, you'll need to create a new repository.

  1. Access GitHub.
  2. Click "New" to create a new repository.
  3. For the Owner, if it's a team project, select the team name; for an individual project, select your personal identity.
  4. Enter the repository name to ensure it's not duplicated.
  5. Provide a brief description.
  6. Choose between Public and Private based on the situation. (Public is recommended for portfolio use.)
  7. For "Add a README file," it's recommended to create one, but you can proceed without checking as you can create it later without issues.
  8. It's advised to check "Add .gitignore." (Even for personal repositories, if they contain crucial information like API keys, it's recommended to list them in .gitignore to restrict pushes.)
  9. If prompted to "Choose a license," you can organize and upload it separately. (You can proceed without selecting, but for Public repositories, it's recommended to review the content and then choose.)
github connectgithub connect2

Connecting GitHub Repository Using Terminal Commands

In summary, "GitHub create a new repository on the command line" entails creating a new GitHub repository and connecting local and remote repositories. On the other hand, "Push an existing repository from the command line" involves connecting an existing local Git repository to a GitHub repository and uploading changes.

As the task involves disconnecting an existing connection, creating a repository, and then establishing a connection, we will copy the "Push an existing repository from the command line" command.

Sample Code

git remote add origin git@github.com:cptkuk91/explain.git
git branch -M main
git push -u origin main

Explanation

  • Name
    Proceed Step by Step
    Type
    Description

    It's fine to paste the lines one by one, but you can also paste and execute them all at once.

  • Name
    Verify the Connection
    Type
    Description

    If you entered git remote -v in a GitHub-disconnected repository and didn't see any response, after inputting the above command, you'll see origin git@github.com:cptkuk91/explain.git as output.

  • Name
    git add .
    Type
    Description

    Once connected, let's upload all the data to the GitHub repository.

    After GitHub Repository Connection

    git add .
    git commit -m "[Add] Migrate existing repository"
    git push origin explain
    
  • Before uploading all the data, make sure to check .gitignore.

  • If you get stuck at git add ., it's likely because there are no changes. You can write a comment or something to proceed.

github connect 진행