Remote address: 150.0.0.1
Remote user: joe
Remote repos should be able to accept push
from other repos. Therefore, we need to setup a bare
repo:
mkdir foobar.git
cd foobar.git
git --bare init
# Start a local repo
git init
# Add remote
git remote add origin master joe@150.0.0.1:foobar.git
# Stage all files for initial
git add .
# Commit all staged files
git commit -m "initial"
# push files upstream and tell local git to connect/track the current branch with the remote one.
# this enables us for the future doing only: git push/pull vs. git push/pull origin master
git push -u origin master
By default git push
pushes to all name matching remote branches. To enable git push/pull
to act as one might assume do the following:
git config --global push.default upstream
if you forgot to track, do it now (based on the current branch)
git branch -u origin/master
checkout a remote branch and track it
git checkout -t origin/branchName
now you could make changes to your local copy of "branchName" and push it back via:
git push
git status -sb