DEV Community

Cover image for Part 04 - Configure Git for Collaboration
Johirul Islam
Johirul Islam

Posted on

Part 04 - Configure Git for Collaboration

Source Code Files of this Chapter

project-root/
├── app/
│   └── Core/
│       └── Bootstrap.php
├── .git/                                   # new directory
└── public/
    └── index.php
Enter fullscreen mode Exit fullscreen mode

Using Git

We are in the very initial stages of a framework creation. Now it is time to configure git.

You are creating a framework, right! So Git will be a handful tool for collaborating with colleagues, teams, or friends, or for sharing code by embedding it in blog posts.

Do you have any account of git cloud repository hosting like GitHub or any other? If not, just create an account and it is free.

Configure Git on Local

# Go to the project root
> cd <project_root> 

> git init

> git add .

> git commit -m "Initial commit"
Enter fullscreen mode Exit fullscreen mode

Configure Git on Remote

Create a new repository on the github and configure

Copy the remote repository url

Push Changes to GitHub

To make a connection between your local and remote repository first of all you have to set the remote origin. So, set the remote repository url as a remote origin and push changes.

# Go to the project root
> git remote add origin <remote_repository_URL>
>
> git push -u origin <branch_name>
Enter fullscreen mode Exit fullscreen mode

⚠️ Important

Github uses SSH Key to establish a connection between your local machine and github.com. You have to generate SSH key to your local machine if it is not exist and add to your github account.

Result

Go to your remote repository and you will see your source code is uploaded.

Learn More

⬇SOURCE CODE: Chapter 04

Top comments (0)