------------------------
get git and set your system up with git:
---------------------------------------------------
- install using apt-get:
- get the requisites:
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
- get git:
wget https://git-core.googlecode.com/files/git-1.8.1.2.tar.gz
- unzip :
tar -zxf git-1.8.1.2.tar.gz
- go into the directory for installation
cd git-1.8.1.2
- install :
make prefix=/usr/local all sudo make prefix=/usr/local install
- setup your github account into the git installed in your system
git config --global user.name "alimurreza123" git config --global user.email alimurreza123@yahoo.com
- If everything works fine you will be able to see the already set user info using the following
git config --list
It should show:
user.name=alimurreza123 user.email=alimurreza123@yahoo.com
- Reference
Create a sample project to push into the repository:
-------------------------------------------------------------------
- create a workspace in your machine and get into the base directory of the project named 'testing':
-
mkdir -p ~/git/testing
cd ~/git/testing
- copy few files and directory there. In real situation you will have your project directories such data, output, src etc.
- converting the existing project into workspace environment
git init
It should show the following message:
Initialized empty Git repository in /home/user/git/testing/.git/
- add everything inside the 'testing' project
git add .
- Push the files using commit
git commit -m "Initial Commit" -a
It says you have committed all the files/folders (-a option) and your message is "Initial commint" (-m) option
Alternately you can add files folders explicitly using by their names
- If you want to push it into some remote server you need to push the project using 'push' from git.
git remote add origin ssh://git@github.com:alimurreza123/testing.git
- If the above does not work try the below:
- git remote set-url origin https://github.com/alimurreza/testing
- Now push the project 'testing' into github repository
git push origin master
It should show the something similar like this:
Counting objects: 6, done. Delta compression using up to 8 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 2.06 KiB, done. Total 6 (delta 0), reused 0 (delta 0) To git@github.com:alimurreza123/testing.git * [new branch] master -> master
- If the above does not work try force push as follows:
git push -f origin master
- "git push tells git that we want to push our changes, "origin" is the name of our newly-configured remote server and "master" is the name of the first branch."
- You may need to setup you ssh-key before you can do this. Following talks about it.
- Reference:
- Add a folder
- git add matlab_src
- git add matlab_src/*
- git commit
- git push
- Remove files
- git rm afile.m
- git commit -m "removing my file"
- git push
- Update files
- git pull
- set url
- git remote set-url origin https://github.com/alimurreza/electro_migration_failure_pred
- git commit -m "Initial commit"
- git push
- ssh-keygen -t ed25519 -C alimurreza@gmail.com
- pbcopy < ~/.ssh/id_ed25519.pub
- Go to github-->settings-->SSH & GPG Key
- then just paste it
using ssh:
-------------------------------------------------------------------------------------
- generate the public-private key pair
- Add the public key in your github settings
- select the paraphrase wisely. You will be prompted to enter the paraphrase when you want to push files into remote repository such as github.
- cloning a repository
- git clone https://github.iu.edu/mdreza/electro_migration_failure_pred.git
- for cloning into iu server:
- git clone https://github.com/alimurreza/electro_migration_failure_pred.git
- git checkout master
Other reference:
No comments:
Post a Comment