Can someone walk me through a few steps with git? I'm wasting hours trying to do stuff that supposedly is simple.
I have a server called开发者_如何学编程 MyServer. It has a shared folder, CodeInGit, on it. I want to create a VS 2010 project called MyProject. (For starters, a blank solution file is sufficient.) I want to create a repository specific to this project.
What I want to do is:
- Create a repository on MyServer under its C:\CodeInGit\MyProject.
- Create my local repository, in C:\Users\me\CodeInGit\MyProject.
- Create the solution file (MyProject.sln) in C:\Users\me\CodeInGit\MyProject
- Add, commit, and push the solution file.
(I have git installed on the server and my PC. I've run through numerous rounds of git init
or git init --bare
and, after a plethora of error messages, I think it's better if I yield to someone who has a clue about how to do this correctly.)
On the server:
cd c:\CodeInGit\MyProject
git init --bare
Locally, assuming that the server directory c:\CodeInGit\MyProject
is mounted as \\servername\MyProject
:
cd c:\Users\me\CodeInGit\MyProject
git clone //servername/MyProject .
Create the Visual Studio solution in c:\Users\me\CodeInGit\MyProject
, then
git add MySolution.sln
git commit -m "New solution added."
git push origin master
You will probably also want to create a file called .gitignore
with the following contents:
bin
obj
*.suo
*.user
so that compiled files and files containing user-specific settings won't accidentally get added to the repository. Then, add and commit .gitignore
.
精彩评论