How to initialize a git repository and linked it to a remote repository provider

For example we've just created a new project and want to push it to a remote repository. Here's what we need to do.

  1. Find out what is the repository url, you can see it at github. For example: https://github.com/czetsuya/JAX-RS-REST-Security.git
  2. Open command prompt
  3. Change directory to where your project is.
  4. In the command promp execute:
    1. >git init
    2. >git add .
    3. >git commit -m "Initial commit"
    4. >git remote add origin https://github.com/czetsuya/JAX-RS-REST-Security.git
    5. >git push -u origin master
What if we already initialized our repository? Then we can already skip steps 4.1-4.3 and just execute:
  1. >git remote add origin https://github.com/czetsuya/JAX-RS-REST-Security.git
  2. >git push -u origin master

0 nhận xét:

Đăng nhận xét