Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Getting a Git Repository

    • 0
    • 2
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 615
    Comment on it

    Importing the GIT Repository : Getting the Git repository is very easy. A git repository is a place where the copy of a project is tacked.We can import the git repository or project from local or remote machine. We can get the git repository in our system in two ways :

    1) Initializing a Repository in an Existing Directory

    If you have newly created project and you want to track that project using git.Suppose my project name is MyProject.So I need to go inside that project directory using cd command and then create a git repository on it. For example :

    $ cd MyProject
    $ git init
    

    This will create a new subdirectory .git inside the project's root directory which will contains all the necessory repository files.Nothing is traced yet, first you need to add those file on repository which you want to track down, and then commit the changes. For example :

    $ git add .
    $ git add README
    $ git commit -m First commit message.
    

    Here the first command will add all the files under the root directory to the staging mode.The second command will add the file named README to the staging. And finally the commit command will commit the changes or the files which are in staging mode.

    2) Cloning the Repository From Existing Git Repository :

    In the above section we have saw how we create a repository on existing directory. Now what if we have already a repository at local system or in remotely, and we want to take code from that repository and work around. So git provide a command to checkout files from the existing repository. Following is the command to take copy of project into the local computer:

    $ git clone <path-to-repo>
    

    The above command will clone the repository which located at onto local computer. The can be exist at local system or in a remote machine accessible via HTTPS or SSH. Or you can use following command to clone the repository to the specified directory :

    $ git clone <path-to-repo> <directory>
    

    For example:

    $ git clone ssh://test@example.com/path/to/my-project.git 
    

    This command will clone the repository to your local system.You can create new files, can modify old files and can commit your changes.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: