Domanda



I have an empty git repository on the server which I can clone to my local machine using git clone. My question is, how do I add a new visual studio 2010 project to that repo?

Concretely, I created a folder and named it "repos". Inside the folder, I run the following command on git bash to clone my empty repo - git clone (pseudo-code), which creates a folder called EmptyRepo inside my "repos" folder.

Now if I want to create a new Visual studio project, would I create it inside this EmptyRepo folder? In which case if I'm creating a WindowsForm project named GitTrial, my directory would look like ->

repos/EmptyRepo/GitTrial/GitTrial.sln, which would be my solution file, and
repos/EmptyRepo/GitTrial/GitTrial/ would contain a bunch of files like bin, obj, Properties, Form1.cs, Form1.Designer.cs, GitTrial.csproj, Program.cs

Or would these files go in a different folder?

Also, inside these paths, where would the .gitignore file go?

Thanks!

È stato utile?

Soluzione

Anything that repos/EmptyRepo/ contains can be added to the EmptyRepo repository, so yes your suggested placement of repos/EmptyRepo/GitTrial/... would work fine.

Before adding files to the repo, I first recommend creating a .gitignore file at repos/EmptyRepo/.gitignore, in which you can ignore user-specific and generated Visual Studio files. Here is a public .gitignore repository that contains a suggested Visual Studio .gitignore.

Next, use git add to add whatever files you want to include in the repository. Ex: git add GitTrial/GitTrial.sln to add an individual file, or git add GitTrial to add the entire directory and its children, excluding those in the .gitignore.

Lastly, git commit your changes and git push to the remote EmptyRepo repository.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top