ผลต่างระหว่างรุ่นของ "01219245/repository setup"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
แถว 34: แถว 34:
 
*** Run that command to add the remote origin to your local Git repository.
 
*** Run that command to add the remote origin to your local Git repository.
 
*** Then '''push''' your first change to the server by calling '''<tt>git push -u origin master</tt>'''
 
*** Then '''push''' your first change to the server by calling '''<tt>git push -u origin master</tt>'''
 
+
* If you have your local Git repository:
 
+
** Change directory to your Git directory.
* For GitHub's users: after you created a new repository, GitHub shows you a quick guide to get started.
+
** Add the remote origin.  Follow the instructions the service provides you.  The command should start with '''<tt>git remote add origin</tt>''' follow by the repository URL.
 
+
** Push your repository with: '''<tt>git push -u origin master</tt>'''
 
 
 
 
* For BitBucket's users:
 
  
 
== Basic work flows ==
 
== Basic work flows ==

รุ่นแก้ไขเมื่อ 16:35, 4 มีนาคม 2557

This is part of 01219245.

There are a few reasons why you would want to host your Git repository.

  • It makes sharing codes easy. (This is the main point for our class, because I have to look over your work in the course.)
  • There are additional tools that these Git hosting websites provide, e.g., issue trackers and wikis.
  • You have all your development code backed up. So, you don't have to worry that your notebook's hard disk might be broken and you have nothing left.

In this course, you have to host your Git repository (that contains your code and assets) on the web. Here are two main choices for the services:

  • GitHub - if you want your repository to be publicly viewable, GitHub is the famous choice.
  • BitBucket - also hosts Git repositories. If you want a private repository, BitBucket has a free plan for you if you have no more than 5 collaborators.

Both services also provide GUI applications for maintaining Git repository. While we encourage the usage of Git command line, but if you want to use the GUI version provided by the services, it is OK.

Getting started

Pick the hosting service (GitHub or BitBucket) and create a repository for your project. If you create a private repository in BitBucket, don't forget to add me (jittat@gmail.com) to the project with Read permission. See figure below, for BitBucket:

Bitbucket-read.png

After that, you will have an empty repository at the server. The next step depends on if you have a local repository for the project. If you have not done anything, you can just clone the repository from the server and start developing. If you have implement some of the game and have local repository, you should start by adding the remote origin and then push your code to the server.

Here are the instructions:

  • If you have no local Git repository (i.e., you start a new project):
    • You should start with our template as if you are starting to work on the tutorial. Unzip the template. Rename the template directory to your project's name.
    • Create a Git repository by calling git init in your project directory.
    • Create .gitignore if you need.
    • Add the files from the template.
    • Commit the changes, so that you have something to push to the remote repository.
    • Now depending on the services (GitHub or BitBucket), you should add the remote origin.
      • Both websites would show you the command that begins with git remote add origin follow by the repository URL.
      • Run that command to add the remote origin to your local Git repository.
      • Then push your first change to the server by calling git push -u origin master
  • If you have your local Git repository:
    • Change directory to your Git directory.
    • Add the remote origin. Follow the instructions the service provides you. The command should start with git remote add origin follow by the repository URL.
    • Push your repository with: git push -u origin master

Basic work flows