Home » Source Code Management ( SCM ) » GitLab » How to push your project to GitLab ?

How to push your project to GitLab ?

Once we have created the project as mentioned “Getting started for First Project with GitLab” and added SSH keys “How to add SSH keys in GitLab ?“, its time now to push our first repository source code to GitLab.

Here we are creating simple source code with single text file, commit this to local git and then push to project in GitLab.

$ mkdir helloworld
$ cd helloworld_new/
$ git init
$ git branch -m main
$ git branch
* main
$ echo "hellowrld GitLab" > helloworld_readme.txt
$ git add .
$ git commit -a -s
$ git log
commit 30ecaca9abec852d595d2ea8d44a45cec3ada720 (HEAD -> master)
Author: Lynxbee Developer <social@lynxbee.com>
Date:   Fri Apr 8 14:43:03 2022 +0530

    Helloworld to test GitLab
    
    Signed-off-by: Lynxbee Developer <social@lynxbee.com>
$ cat .git/config 
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
$ git remote add origin https://gitlab.com/lynxbeedev/helloworld.git
$ cat .git/config 
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = https://gitlab.com/lynxbeedev/helloworld.git
	fetch = +refs/heads/*:refs/remotes/origin/*
$ git push origin master

Leave a Comment

Sign up to our newsletter!