Thursday, 7 August 2014

Working with your github repository via Linux or putty


Login to your github account and create new repository with read.md


Go to the folder where you like to get the repository copy in your local system
e.g: cd /media/rajiv/D A T A/Learning/

git clone /path/to/repository
like in my case
git clone https://github.com/krajiv26/quizmaster/
means git clone https://github.com/<yourUsername>/<yourRepositoryName>/

You will get whatever in the repository till now
Move into the new directory with cd quizmaster/

Copy your new file in this directory
go with
git add <filename> or
git add *
to add all files

Now commit your files with
git commit -m "Commit message"


Now push your changes to repository on the github server
git push origin master

It will ask for username and password so be ready with both things:
Username for 'https://github.com': <yourUsername>
Password for 'https://<yourUsername>@github.com': <your password >

And that all. you can check over github account your files added there.

Working with Github for next push of updating file over github again

Now you have to set your non-readonly url to push your local changed file again

git remote set-url origin https://github.com/krajiv26/quizmaster.git
means git remote set-url origin https://github.com/yourUsername/YourRepositoryName.git

git remote add origin git@github.com:krajiv26/quizmaster.git
means git remote add origin git@github.com:YourUsername/YourRepositoryName.git

However you can add username and email in the config with
git config --global user.name "YourUsername"
git config --global user.email "YourEmail"

You can check your all set values in config with
git config --list

Lastly you have to write
git push
to add all code in your local commit to the github
it will ask for username and password


No comments :

Post a Comment