git and gitlab tutorial for begineers
This is a list of commands to be executed when using github. This is still blog in progress, but sharing it so my colleagues could benifit. I will be making it more descriptive as time permits, so it will be easy for a beginner. Please bear with me for some more time.
git add files
git status (green indicate files are added for staging)
open text file. Make changes.
when making changes new line is required.
modified files shows red.
gif add .
file is shown green
git commit -m “added a second line”
(change font size – go to upper left corner, select lucida console, font size)
setting remote repository
go to https://gitlab.com
click on net project
give project name same as your directory name in local
namespace – sachinwalvekar
description – testing git commands for the first time
visibility level – private
add ssh key – its related to machine
click on ssh help page
follow the instructions
check if ssh already on system by running the command – cat ~/.ssh/id_rsa.pub
go to gitbash
right click on upper left corner
click on edit – paste
if you see the ssh key
to copy it
go to upper left corner
click on mark
select the ssh key
press enter to copy
(note if you see ssh with another username….logout, restart gitbash, use git global setup commands as follows
git config –global user.name “sachin walvekar”
git config –global user.email “firstname.lastname@example.org”
ssh-keygen -t rsa -C “$your_email”
copy the ssh key to an editor and remove newlines….make it one single line
copy ssh link to gitbash
git remote -v
git remote add origin email@example.com:sachinwalvekar/testgitcom.git (copy the url)
git remove -v
origin – alias
git push origin master – Pushing the local content to remote. Master means branch.
click on gitlab
check the project & files
now change the content of txt file
git add .
git commit -m “this is third line”
git push origin master
part 2 –
got to project
select as developer
git clone url (add ssh url)
a directory with same name will be created on drive
change the content
change diretory in git bash
git add .
git commit -m “fourth line added”
git push orgin master
(this failed as access is only as developer
git remote add upstream ssh (fork copy ssh) – copy of project was created on Prasad walvekar repository on gitlab
git push upstream master
Now have to send merge request