Setting up a GitHub repository

1:Create a git repo on github

2: Initialize git repository with below code.

cd /path/to/your/existing/code
git init

You’ve now got a local git repository. You can use git locally, like that, if you want. But if you want the thing to have a home on github, do the following.

  • Go to github.
  • Log in to your account.
  • Click the new repository button in the top-right. You’ll have an option there to initialize the repository with a README file, but I don’t.
  • Click the “Create repository” button.

Now, follow the second set of instructions, “Push an existing repository…”

$ git remote add origin https://github.com/user/repo.git
$ git push -u origin master
adding Note the command "type gitignore.txt(text filename)" . will open content of the file.
to create file :type nul> gitingore.txt

Adding .gitignore file:

  1. Open Notepad.
  2. Add the contents of your gitignore file from server ( while creating repository created git ignore file)
  3. Click “Save as” and select “all files”.
  4. Save as .gitignore.

5:set a remote bracnh

git branch -u origin/master

6: TO add files

git add .

7: push to remote server

git push

Published by codeblogforfun

Coder, blogger, traveler

Leave a comment

Design a site like this with WordPress.com
Get started