Git is not installed by default in Ubuntu12.04. You need to install it yourself.
1. Install git
Can be installed using the Apt-get mode, or you can download the source code installation "1", we use Apt-git installation here.
However, due to the older version of the direct use sudo apt-get install git installation, we refer to the PPA source given in "2".
sudo add-apt-repository ppa:git-core/ppasudo apt-get updatesudo apt-get install git
After the installation is complete, check that the installation is successful
Git--version
Displays Git version 2.1.1, indicating that the installation was successful.
2. Set up Git
(1) Set user name and email.
git config--global user.name "Your name" git config--global user.email "[Email protected]"
At this point, a new. gitconfig file is created in the home directory
3. Add SSH Keys to your GitHub account
A git server that accesses the SSH protocol as a public key authentication does not need to enter a password and is more secure. (When accessing the HTTP protocol's GIT server, such as committing changes, you need to enter a password each time.) )
(1) Create SSH key
$ ssh-keygen-t rsa-c "[Email protected]"
The system will prompt the key to save the location (typically the ~/.SSH directory) and specify the password, keep the default, three consecutive times to enter.
(2) Copy SSH Key
Then use VIM to open the file, id_rsa.pub the contents of the file, paste into the GitHub account management of the Add SSH key interface.
Vim ~/.ssh/id_rsa.pub
(3) Add to GitHub
Login github-> Accounting Settings icon--ssh key-> add ssh key-> fill in the name of the SSH key (which can be easily differentiated by yourself) and then copy the ~/.ssh/id_ Rsa.pub file content sticky, add Key button added.
(4) test
[Email protected]
4. Submit changes for repository on GitHub
(1) Git clone already exists on GitHub repository. (In the new ~/mytestfolder directory)
git clone https://github.com/zhchnchn/ZhchnchnTest.git
(2) Modify a file and then submit
Vim readme.mdgit statusgit Add readme.mdgit statusgit commit-m "Edit by Workubuntu 1204" git statusgit Remote Add Origin H Ttps://github.com/zhchnchn/zhchnchntest.git
Errors will be reported at this time:
Fatal:remote origin already exists.
Workaround "3":
$ git Remote RM origin
Then execute git remote add Origin https://github.com/zhchnchn/ZhchnchnTest.git again
(3) After that, you need to push the changes to GitHub
Git push-u Origin Master
After executing this command, you will be asked to enter the user name and password for your GitHub account.
(4) Once the submission is complete, review the repository on GitHub and find the content modified successfully.
Refer
"1" How to Install Git on Ubuntu 14.04 (https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-14-04)
"2" Installing Latest version of Git in Ubuntu (http://stackoverflow.com/questions/19109542/ Installing-latest-version-of-git-in-ubuntu)
Install git under "3" Ubuntu12.04 (http://blog.csdn.net/biosd/article/details/9115837)
Ubuntu12.04 Installing Git