

$ git push file:///c/git-local-repository-example/my-project.git/ master $ cd MINGW64 /c/git-local-repository-example/my-project (master) My-project/ MINGW64 /c/git-local-repository-example Let's use push command in our example: MINGW64 /c/git-local-repository-example So far there's no relation between our project (my-project) and the repository (my-project.git), but now we are going to push our project to the repository for the first time.

We can also use git branch command (but right now we have no project branches) MINGW64 /c/git-local-repository-example/my-project.git (BARE:master) In above example, since my-project.git does not yet have any projects, it will return an error: MINGW64 /c/git-local-repository-example/my-project.git (BARE:master)įatal: your current branch 'master' does not have any commits yet We can use git log for the bare repository to see the commit history. git directory and without a working tree.īy convention, bare repository main directory name ends with the suffix. It has all commit history but without a parent. It has similar directory structure what we see inside the. What is a bare repository? A bare repository doesn't contain a working directory. In above example we used git init -bare to create a bare repository.

Initialized empty Git repository in MINGW64 /c/git-local-repository-example/my-project.git (BARE:master) $ cd MINGW64 /c/git-local-repository-example/my-project.git Let's create a directory (my-project.git) representing the remote repository for our above project: MINGW64 /c/git-local-repository-example Now let's host above project from a central location on the file-system which will be acting as remote repository. So far there's nothing new, we have been doing same thing in previous tutorials. The file will have its original line endings in your working MINGW64 /c/git-local-repository-example/my-project (master) Warning: LF will be replaced by CRLF in readMe.txt. $ echo test content > MINGW64 /c/git-local-repository-example/my-project (master) Initialized empty Git repository in MINGW64 /c/git-local-repository-example/my-project (master) $ cd MINGW64 /c/git-local-repository-example/my-project $ mkdir MINGW64 /c/git-local-repository-example $ MINGW64 /c/git-local-repository-example Let's start git bash from which we will create a project under a directory 'my-project' and will add that to Git. Let's see that step by step with an example.
#Git add remote url how to#
In this tutorial we will keep the things simple and see how to push, clone and pull projects over the local protocol (local file system). The main purpose of a remote repository is to place the repository to a central location so that it can be accessed by multiple developers.Ī remote repository can be accessed via http, ssh or even local (file-system) protocols. The remote Git repositories host our projects through the Internet or network.
