So richten Sie ein GitLab-Repository unter Windows 10 ein
14:37, 26.05.2026
Whether you're a solo developer or part of a collaborative team, integrating GitLab into your workflow on Windows 10 is essential for managing code changes, backups, and collaboration. This guide walks you through the steps needed to set up a GitLab repository, covering everything from cloning and initializing repositories to setting up authentication.
Cloning a Repository from a Remote Host
To begin working with a GitLab project that's already hosted remotely, you’ll typically clone the repository.
- Install Git for Windows if you haven’t already: https://git-scm.com/download/win
- Open Git Bash or your terminal of choice.
- Use the following command to clone the repository:
git clone https://gitlab.com/username/project.git
This will create a new folder containing the project files and the .git directory used for version control. After cloning, you can immediately begin editing files and pushing changes back to GitLab.
Initializing Git Version Control for an Existing Project
If you have a local project that’s not yet under version control, you’ll need to initialize Git.
Navigate to your project directory in Git Bash:
cd path/to/your/project git init
Git will create a .git folder in your project directory, marking it as a repository.
Linking the Entire Project to a Single Git Repository
To track the entire project under one Git repository, ensure you're in the root of the project folder when running git init. All subfolders and files under this directory will be tracked together as a single repository.
Connecting Separate Project Directories to Different Git Repositories
In more complex setups, such as monorepos or plugin-based architectures, you might want different parts of your project to be tracked separately.
To do this, navigate into each directory you want to manage independently and run:
git init
Each subdirectory will now have its own .git folder and will act as a standalone Git repository.
Staging Files for the Local Repository
Once Git is initialized, you can begin tracking files:
git add .
git commit -m "Initial commit"
This stages all current files and commits them to the local repository. From here, you can push your commits to a remote GitLab repository.
Ignoring Files in Git Version Control
Not every file in your project should be tracked—like logs, temp files, or compiled binaries. Git allows you to define which files to ignore.
Using .gitignore or .git/info/exclude to Exclude Files
Create a .gitignore file in the root of your project and add patterns of files or directories to exclude:
*.log
node_modules/
.env
Alternatively, for local-only exclusions, edit the exclude file located in .git/info/. This is useful for excluding files specific to your machine without affecting others.
Connecting to a Remote Git Repository
After initializing your local project, you’ll want to link it to a remote GitLab repository so you can share it or back it up.
Setting Up a Primary Remote
To link to a GitLab repository, use:
git remote add origin https://gitlab.com/username/project.git
Verify the remote:
git remote -v
Then push your changes:
git push -u origin master
Adding an Additional Remote Repository
Sometimes, you may want to push the same project to multiple remotes. For example, one on GitLab and another on GitHub.
git remote add backup https://github.com/username/project.git
You can now push to both:
git push origin master
git push backup master
Managing Git Remote Authentication
When pushing or pulling from GitLab, you must authenticate. Git offers several methods, including HTTPS with username/password, SSH keys, or personal access tokens.
Setting Up Password Requirements for Remote Access
If you're using HTTPS, GitLab now requires a Personal Access Token (PAT) instead of a password for authentication.
- Go to your GitLab account.
- Navigate to User Settings > Access Tokens.
- Create a token with the required scopes (read_repository, write_repository).
- Use this token in place of your password when Git prompts you:
Username: your_username
Password: <your_personal_access_token>
Alternatively, you can cache credentials for convenience:
git config --global credential.helper wincred
For added security and convenience, consider setting up SSH keys instead of using HTTPS.
By following these steps, you can confidently set up, manage, and collaborate on GitLab repositories from your Windows 10 machine. Whether you're working solo or in a team, proper Git setup ensures a smoother development process and better project organization.