Follow the below steps in your linux machine to create git repository and push to your remote github account repository.
I am pulling/pushing the github commits under IIT Delhi proxy. If you have proxy, then change the proxy address and port no according to yours.
$ su root
step 0: Login as root and enable/set http_proxy and all.
# vim /root/.bashrc
add the above lines. Also go to Network proxy settings in your ubuntu and set the system proxy as above.
step 1 :
# git config – -global http.proxy http://proxy62.iitd.ernet.in:3128
# git config – -global https.proxy http://proxy62.iitd.ernet.in:3128
# cat ~/.gitconfig
Add your laptop ssh public key to your github account
step 2 : https://help.github.com/articles/generating-ssh-keys
Either follow the above post link or follow the below steps:
# apt-get install xclip corkscrew
# ssh-keygen -t rsa
# xclip -sel clip < ~/.ssh/id_rsa.pub
# vim ~/.ssh/config
ProxyCommand corkscrew 10.10.78.61 3128 %h %p
add the above lines to config file. Mention 10.10.78.61 is proxy ip address (instead of proxy host name like proxy62.iitd.ernet.in) and 3128 is port.
add the copied public rsa key (via xclip) into https://github.com/settings/ssh and set some title.
Then do the following, you will get “Hi your github user name! You’ve successfully authenticated, but GitHub does not provide shell access.” response. If you get some thing like below, then your settings are working correctly.
# ssh -T firstname.lastname@example.org
Hi arulalant! You’ve successfully authenticated, but GitHub does not provide shell access.
Now you can move to step 3.
step 3 : Create a repo in github account
I created repo named ‘UV-CDAT-IPython-Notebooks’
step 4 : add files to your local repo then do commit
git clone email@example.com:username/repo.git
# git clone firstname.lastname@example.org:arulalant/UV-CDAT-IPython-Notebooks.git
by the above way, we cloned the github repo into local system.
step 5.0 : pull the changes you made in the README.md file in github account through browser itself.
# cd reponame
# cd UV-CDAT-IPython-Notebooks
step 5.1 : # git pull origin master
pull your changes which you made through browser in github ‘origin’ repo ‘master’ branch to local repo.
step 5.2: update global github profile in our local system
git config – -global user.email “email@example.com”
git config – -global user.name “Your Name”
# git config – -global user.email “firstname.lastname@example.org”
# git config – -global user.name “arulalant”
step 6.0: make some changed or add new files into local repo. then do # git add filename, # git commit & finally push local changes into github repo by below command.
step 6.1: # git push origin master
push your changed which you made locally to the remote ‘origin’ [github acc] to ‘master’ branch.
it will ask username of github and passwd. enter username [arulalant] itself, no need to enter as login email id.
If you dont like to enter your username & passwd every time (applicable only if you cloned project repo via https instead of git) then follow the below step.
step 6.2 :
git remote set-url email@example.com:username/repo.git
$ git remote set-url origin firstname.lastname@example.org:arulalant/UV-CDAT-IPython-Notebooks.git
The above command must execute inside the project directory. It will tell github to use your ssh public key instead of asking you to enter your credentials every time.
PS : you can try to set all the above 6 steps into normal user itself instead of root.
Its works fine for me.
Now I can release all my development code as well as fun code. 🙂