![]() However, before you proceed with this tutorial it is very important that you have gone through the previous set of tutorials on GIT here: This page is licensed under a CC-BY-NC-ND license.In this tutorial, we will learn How to Create Git Repository. Hopefully this small guide helps you running Git on Windows Server. Doing projects on Github, most of it just seems like magic. It’s actually a lot easier than I had expected to get that up and running. Now you can develop as normal and push just like you would to Github, but now it pushes to your local network. There’s a lot of slashes but this will point our new local repository to have the remote point to the central repository. Using the drive letter of the network drive, run the following command: git remote add origin file:///z:/MyProject.git Next thing is to add our newly created shared repository as a remote in our project. In that directory, you would do the normal ‘git init’ command without the flags from above. Create your project directory anywhere you like. Now it’s time to start committing files to the repo. ![]() Local Git RepositoryĪt this point you should have a mapped network drive that has MyProject.git in it. Since it doesn’t have a copy of the files, edits cannot be done directly to them through that repository. Your central repository is now up and running. After that finishes, this is what should in the directory. If you want to read further on other flags, you can visit the git init documentation. To be honest, I’m not entirely sure this flag is required, but it doesn’t hurt. The ‘shared’ flag says this repository will be shared among many users. It will act as a hub of the change to those files. The ‘bare’ flag means that this repo won’t keep a working copy of the files. Next you will want to bring up Git Bash and inside this new directory, run the following command: git init -bare -shared The ‘.git’ is optional, as it’s more of an indicator that this folder is a central Git hub for the project. In the shared folder on the server, create a folder called MyProject.git. For this, my project will be called MyProject. Now that you have a shared folder to store your repos and mapped it to a network drive on your machine, the next step is to create your project’s central repository. I’ll go more into detail about this when the repository is initialized in the next section. You will need to do this also to start adding files to the repository as the server repository won’t hold a working copy of the project files. This way you can create as remote repositories as you want under a single point of reference for people.Īfter the folder is shared, anyone who wants to use the repository in Windows will need to setup a network drive on their machine. I recommend creating a folder that can hold multiple repositories. The next step is to share a folder across the network so that different people can do pulls and pushes from the repository. Once the setup is complete, Git is now running on your server. If the project is exclusively Windows based, then the third option will probably be fine. ![]() That way if a file is opened using Visual Studio or some Windows exclusive editor, your new lines will be retained. This is usually the best choice if there’s a possibility this repository will be used cross platform. I usually select Checkout Windows-style, commit Unix-style line endings. The only choice you have to make is on line endings which you will make on this step: Most of the options when installing it can be left as the defaults. If you visit this link, Git will automatically start downloading. The first thing to do is install Git for Windows on the server. I’ll assume you have some basic knowledge of Git, what it is and how it works. Since this is something that I know I’ll probably do in the future, I wanted to document my steps here, not only for myself, but for anyone else that doesn’t really know where to start on getting that up and running. I just had the experience of getting a local Git repository setup on a Windows Server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |