Install Git
- Use the package manager to install git:
CentOs: yum install git
Ubuntu: apt-get install git
Initialise a Local Repository
- Change to your local git repository directory e.g.
mkdir gitrepo
cd gitrepo - Initialise git:
git init
Add a Remote Path
You might want to cache your credentials:
git config --global credential.helper "cache --timeout=3600"
git config --global credential.helper "cache --timeout=3600"
- Ensure you're on master locally:
git checkout master - Add a remote path e.g.:
git remote add origin [path]
e.g. https://[somename].visualstudio.com/DefaultCollection/_git/[SomeProject] - Set the local 'master' to track the remote 'master':
git branch --set-upstream-to=origin/master master
Set the Default Git User
- Set your email:
git config --global user.email "you@example.com" - Set your name:
git config --global user.name "Your Name"
Update your files
- Pull from remote: git pull
- Set a global ignore (or it will add system files): echo "*" > .gitignore
- Add files to the repo: git add .
You'll need to explicitly add files as we have a global ignore - Commit your local changes: git commit -m"Some commit message"
- Push to remote: git push
No comments:
Post a Comment