Configuring GIT Repository

"In software development, Git is a distributed revision control and source code management (SCM) system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005. Every Git working directory is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server." — Wikipedia

GitLab Logo Linux Windows 7

Creating GIT Repository

  1. Login to the GIT Server at https://git.dei.uc.pt using your DEI credentials.
    Git login screenshot
  2. In the dashboard, click "New Project".
  3. Enter the project name and set its visibility (private by default), then click "Create Project".
  4. Set up SSH keys from your client.
    Use Git Bash (Windows) or Terminal (Linux):
    ssh-keygen -t rsa -b 4096
  5. Add your SSH key to your profile at Profile Settings → SSH Keys.
    • Click the green button Add SSH Key.
    Add SSH key screenshot
  6. Insert the Title and paste your public SSH key.
    • The default location is $HOME/.ssh/id_rsa.pub
    Paste SSH key screenshot

Install and Configure GIT Client on Ubuntu

  1. Open the Terminal and install git:
    sudo apt-get install git
  2. Set up git global config:
    • git config --global user.name "Your name here"
    • git config --global user.email "Your email here"
  3. Create a new file (e.g., README.txt) and write something in it.
  4. Initialize the repository:
    git init
  5. Add the file to the repo:
    git add README.txt
  6. Commit the changes:
    git commit -m 'Your comment here'
  7. Add remote origin:
    git remote add origin git@git.dei.uc.pt:your_username_here/your_project.git
    Git remote screenshot
  8. Push the code:
    git push -u origin main

Configuring GIT Client on Windows

  1. Download and install Git for Windows: http://msysgit.github.io/
  2. Open Git Bash and generate an SSH key:
    ssh-keygen -t rsa -b 4096
    SSH keygen screenshot
  3. Configure git:
    • git config --global user.name "Your name here"
    • git config --global user.email "Your email here"
    Git config screenshot
  4. Open Git GUI and select Clone Existing Repository.
    Note: It must not be an empty repo. If so, use Create New Repository or follow the Ubuntu guide.
    Git GUI clone
  5. Define:
    • Source Location: Git project URL (see Ubuntu step 7)
    • Target Directory: Local folder for your project
    Clone settings
  6. After clicking "Clone", confirm server RSA key.
    Type yes and click OK.
    Confirm RSA
  7. Open Git GUI in the repo folder and go to Commit → Stage to Commit.
    Stage commit
  8. Click Push.
    Push changes
  9. Select the source branch (e.g., master) and click Push.
    Select branch
  10. The repository was successfully pushed.
    Push confirmation