to setup GitHub on your machine just open a Bash
terminal and become super user by issuing “Su” command
>su
It will ask for password of super user (actually substitute user though) provide same ,now it will
drop you to familiar terminal prompt.
Using super user
login ,We need to update our Repository List as follows
>apt-get update
after updating repo list we will install git to our Debian machine
>apt-get install git-core
Now we have to register at GitLab after registering there create a
project say “myproject”,suppose your gitlab user name is “
yourusername” & email id used for registration is
“youremail@server .com”
Generating
SSH Key:
Now we might need to generate SSH key for secure communication
between GitLab server & our machine.
Run following
command to check if ssh key is already generated on your debian
machine
>cat ~/.ssh/id_rsa.pub
if it yield some response then its there
else generate new
one as follows
>
ssh-keygen
-t rsa -C "
youremail
@
server
.com
"
copy
newly generated SSH key or existing one by looking at output of
command below
>
cat
~/.ssh/id_rsa.pub
response
is something similar to below
ssh-rsa
LMRPTYB3NzaC1yc2FRFGHFGFABAAABAQDs+y4/vM7GHVGHGhjhkjuzq/DFDHHD.FJFGJFyB5NIMKF/ZFVQ0RTBwAcxtyg++LgoVX3h5YLLdRbxn2Q54M0hAIlo05OZXQlAWDwE1RF+Mfis7IHEldHjV/qmnvcEca0ODsiLFJJFGJ7U/kHEEkfZqGFGHFtrfthfghfhVE3S+GHGHJGHGHGHGHGHJG/GGFHJGHJGHJGihkjgyhg
youremail@server.com
copy
whole stuff from response of command starting from ssh-rsa till end.
now go to your
githab profile setting into “SSH Key” tab and add key.
Now we need to tail our machine about destination
as follows
>git config --global user.name "yourusername"
git config --global user.email "youremail@server.com"
now move to your existing project root as follows
>cd existing_folder
now you can push your project to GitLab as follows.
>git init
>git remote add origin git@gitlab.com:youremailusername/myproject .git
>git add .
[Note: the dot(.) in above command is not by mistake but required tell all files within folder]
>git commit -m "my first githab commit"
>git push -u origin master
>git push -u origin master
suppose we want to push a new project then move to folder where your
project will reside and issue following command that will copy
content in GitHab project newly created through website obiviously at
this point it is empty,yet it will create .git folder which will act
as setting for git library to which git destination project belong
what is current state & current branch
>git clone git@gitlab.com:youremailusername/myproject.git
>add a readme file with some information about project as follows
>cd myproject
touch README.md
git add README.md
>nano README.md
>git commit -m "add README"
>git push -u origin master
>git push -u origin master
Now check on GitLab server if readme.md file saved on server under given project.
No comments:
Post a Comment