Thursday, December 4, 2014

git - Version control

git , implemented as a service by gitlab and github, offers DVCS - distributed version control - which has a number of advantages over previous approaches using CVS, SVN or older proprietary approaches such as PVCS. Gitlab and Github differ mainly in there focus with Gitlab aimed at corporate's that might want continuous integration features 'out-of-the-box'. Github is bigger and has recently been acquired by Microsoft.

Git's basic advantages are that it:
- allows developers to version locally, although I am currently using onedrive to backup active files and folders
- allows sharing, backup and version-ing to the cloud via github
- provides a fast and efficient toolset
- it is either free or very cheap, depending on how it is used.

These advantages are better described here

github is free for a single user, if you don't mind anyone seeing the contents of your repository.

If you understand the principals of version control then this text will bring you up to speed with the product and the key differences with SVN.

Then try the on line interactive tutorial here.

If you understood that the next step I would recommend, assuming you have some basic Linux command line knowledge and are on a Windows machine, is to create a free github account and install git locally within Cgywin. Installing and using git this way does not impact the rest of your Windows installation like using an extension to Windows Explorer would. It also installs everything you need in one process.

For Ubuntu install using sudo apt-get install git-core

If you do not have a github account create one here. My example is 'https://github.com/colfraser/'

Install Cygwin from the project page. Follow the install defaults until you get to the Select Packages dialogue . Type 'git' in the search field and install from the devel category. The package is call 'git: Distributed version control system' or something close to it. In a similar fashion also install ssh, take this from the net category, it will be called something like openssh. The current version of Cgywin references git version 1.7.9 which works fine. The installation may take up to 5 minutes depending on connection speeds.

Check the install at the Cgywin command line with the following command,

git --version

#set up local variables to match how you have set up github.
git config --global user.name "Colin Fraser"

git config --global user.email "address@domain"

#Check the config just entered
more ~/.gitconfig

#This commands generates the security keys which will will ignore for the moment
ssh-keygen -t rsa

create a new repository on github, for example PET_Names. Use the '+' button the top of the screen. Check the box next to 'Initialize this repository with a README'.

env GIT_SSL_NO_VERIFY=true git clone https://github.com/colfraser/PET_Names
#This command allows the SSL security to be ignored so it is not recommended for normal use but it allows the remote repository that we have just created to be instantiated on our local machine.

cd PET_Names # Move into the folder created in the clone process

#Add some files and change the readme
echo 'new line 04/12/2014' >> README.md

git status
# shows modified files

echo "new file" > another_file.txt


git status
# shows modified file and new files

git add .
#add the files to the local 'staging area'

git commit
#commit those files to the local git repository. Add comment in the vi editor box that will pop up. Type 'I' to insert, ':wq' to save.

git status
#will show nothing to commit

git push
#This uploads the committed changes in the local repository to the github repository that was cloned locally previously. The github account name and password will need to be entered. These entries are not echoed to the screen.

#change the xml file using vi or via Windows.

git diff
#will show changes

git add *.xml
git commit
git push

There is a good overview of getting started with git and the GUI local git repository tool tortoise here.

This tool provides an extension to the Windows explorer and was inspired by the SVN tool.

Git for Windows provides a Windows App and 'Git Bash' a command line emulator to access git on Windows like you would on Linux.

A cheat sheet for command line git is here

1 comment:

jane holly said...

This professional hacker is absolutely reliable and I strongly recommend him for any type of hack you require. I know this because I have hired him severally for various hacks and he has never disappointed me nor any of my friends who have hired him too, he can help you with any of the following hacks:

-Phone hacks (remotely)
-Credit repair
-Bitcoin recovery (any cryptocurrency)
-Make money from home (USA only)
-Social media hacks
-Website hacks
-Erase criminal records (USA & Canada only)
-Grade change
-funds recovery

Email: onlineghosthacker247@ gmail .com