So, Lets firstly set-up the remote repository:
Step 1 : ssh will get me access to console on remote pc, will ask for remote pc's password
Step 2 : create a directory with extension .git
Step 3 : go to created directory
Step 4 : initialize git
Step 5 : Update Server configuration for access from non local sites
Step 6 : Exit from remote access
$ssh username@ipaddressofserverpc
$mkdir my_project.git
$cd my_project.git
$git init --bare
$git update-server-info # If planning to serve via HTTP
$exit
Now, On local machine:
Step 1 : go to local folder
Step 2 : Initialize git
Step 3 : add all existing file ( can also be done using GUI, type 'git gui' in cmd
Step 4 : commit
Step 5 : Add remote origin
Step 6 : Push branch for first time
$cd my_project
$git init
$git add *
$git commit -m "My initial commit message"
$git remote add origin username@ipaddressofserverpc:my_project.git
$git push -u origin master
Now,Anybody on network at access git repo:
Step 1 : clone git repository
Step 2 : Step into created directory
$git clone username@ipaddressofserverpc:my_project.git
$cd my_project
To push a newly created branch:
Step 1 : create branch
Step 2 : commit
Step 3 : push
$git branch develop
Do some editing
$git add *
$git commit -m "My initial commit message"
$git push -u origin develop
To push/pull a already created branch:
$git push
$git pull
Comments
Post a Comment