Setting up a Git Repository

Introduction

This is one of a series of posts where I document software configurations for personal reference. This post documents the configurations for setting up a git repository.

User information

git config --global user.name 'zenggyu'
git config --local user.email '[email protected]<domain_name>'

File name display

git config --global core.quotepath off

With this setting, file names that contain CJK characters will be displayed as is by commands that output paths (e.g., git status).

Autocrlf

git config --global core.autocrlf input
git config --global core.safecrlf true

With core.autocrlf input, Git auto converts CRLF (which is the default line ending type for windows) line endings into LF (which is the default line ending type for *nix) when you add a file to the index, and vice versa when it checks out code onto your filesystem. Note that core.autocrlf input is the recommended setting for cross-platform setting on *nix machines. On windows machines, set core.autocrlf true instead.

With core.safecrlf true, Git checks if converting CRLF in a file is reversible and rejects the commit if it is not. See the documentation for more details.

Create a Gitlab repo using command line

git push --set-upstream https://gitlab.com/zenggyu/<project_name>.git master

Related

Next
Previous
comments powered by Disqus