Can't commit changes to GitHub in Visual Studio - visual-studio

I'm pretty new to programming, and I'm having an incredibly difficult time making GitHub and Visual Studio Community 2015 play nice with each other. Usually the first commit goes well, and I can see it on GitHub.com just fine. But it never lets me make any more commits. I make changes to the file, save it, but the commit button in VS stays grayed out. I've been all over the Team Explorer to figure out what I'm doing wrong, and I can't figure it out. It says I have no unpublished changes or anything, even though I'm changing tons of things in the file.
Is there any reason it would stop working after the first commit?

Close VS
Open the particular .sln file from the repo
This worked for me.

You would need to add your username and email in you global configuration. Then you will be able to see the commit button enabled.

I had to add username and mail in VS to activate the commit button. The visual studio message telling me to add the data only appeared after a restart of VS. Maybe this will help someone else.

Try to use git push on git shell, the console will tell you if there are any errors, and give you searchable errors.

I think I figured it out, and as predicted, I'm an idiot. I was accidentally saving the files OUTSIDE the local repo folder. If anyone else has this problem, make sure you are saving things in the right places. Also, cloning the remote repo instead of trying to create two in each place helped a lot.

If you have a local database file, then you will not be able to copy/move the database file, and so any change in the solution cannot be committed. You have either to close the database service, close the connection inside the application or to close the solution and do the commit.

Related

Team Explorer for VS 2013 - can't check in

I have an existing solution that has previously had no problems. I added two new projects to the solution, completing my dev work with no problem, however when I try to check the solution in I get an error similar to the following:
C:\Project1Path\Project1.csproj: Download of item $/Project1/Project1/Project1.csproj was not completed. Perform a get operation to correct.
I get the same when I try to check in just this project. I have not tried checking in the other new project yet as ideally I want to check everything in together.
I did a Get Latest on the solution on the outside chance that that was what the error was telling me to do but to no avail.
Any help appreciated as sooner or later someone else is going to want to work on the solution.
Many thanks
Simon
I had this issue and when I ran get latest in source control it picked up a non version controlled file with the same name and asked to overwrite it.
If you get that conflict make sure you overwrite the local file.
If you don't get a conflict maybe delete local file manually and then get latest.
I'm not sure that'll work but you could try.
If this isn't resolved with a get latest, go to the actual file in team explorer. If it has a small diagonal icon next to it then right click to resolve the conflict manually. Here you can override the changes.
This is here for anyone else who may run into the problem.
In my case the file was deleted in the TFS. Undo pending changes for this file (undelete it) then try to check in again.
Note: you cannot tell if the file is delete just by looking at solution explorer.
It happened to me as well when I tried to checkin the code from TRUNK after merging from feature branch.
What I did is rolling back the change from TRUNK and merging it again.

SVN multiple developer working on single file at same time

Actually I have faced this issue many time during working with SVN. Most of the time I am working with VSS for source control but since last couple of months working with SVN.
We are using tortoise and AnkhSVN with VS 2010.
In our team there are 5-6 people and some of them are working on same file at a time. Now when somebody commit , we have seen that some other developer changes get vanished and Sometime we get some line with version number. This thing get consume lots of time and we have to resolve conflict and all.
Please provide information so we can avoid such issues.
If two developers are working on the same file and make changes to the same are of code, then you have to manually resolve this conflict. There is no way to avoid it, no matter which version control you use.
The version control cannot know what the correct code is, so it requires a human intervention.
There is no way around this, other than preventing the users from working on the same code. this is done in svn by locking the file.
Each developer must svn update before svn commit. Between the update and commit, the developer must do a full, clean build and run all tests to make sure their code still works after merging in all other developer's changes into their copy.
You can set svn:needs-lock on files or folders that need to be locked before making changes, they'll be forced to check for locks. When you will try to edit a file, you will be required to lock it first. And when it is already locked by someone else, they you get an error message, preventing you from making any changes. This can be done in Tortoise SVN in Properties -> Advanced

TFS re-add Visual Studio 2010 project

I have a project that is source controlled using TFS. I was doing some coding on my laptop when, unfortunately, my computer crashed and I ended up having to re-install Windows. I was afraid that all my code would be lost, but thankfully I was able to restore the code files.
My problem is that now I need to commit the changes to TFS. Currently the projects do not have any source bindings. I can't overwrite the current code base because there is work that has been done since my crash by other devs.
How can I add the changes I've made to TFS?
The way i've done something like this is kinda hackish, but what i usually do is get latest from TFS onto my laptop, and checkout all of the code from the project in question. Then i take the changed code and copy it over that folder, check it in. TFS should be smart enough to only really affect the actual code items that have been changed. You can see in the history the actual files that got changed to be sure.
If you know the exact files that you need to update, then that will make things much easier, because you can do the above steps, but then just check out the particular files you know of. You can do a compare between them and your new code to make sure that you don't overwrite anything your other programmers have done. Again, hackish, but i don't know of any streamlined way to do this.
You might want to make sure that you download the TFS visual studio extension, since that will give you rollback capability.

Disabling automatic checkout in AnkhSVN

I'm using Visual Studio 2k8 with AnkhSVN.
When I start to modify file, it's automatically checkouted. How can I disable it? I don't want to accidentally modify my files.
Your files will not be modified in your Subversion repository until you check them back in. And even when they are checked back in, you can still roll them back to any previous point.
So, no need to worry about doing something accidentally...that's the whole point of version control!
What you call "check-out" just means the file has been marked as modified locally on your machine (without the SVN server knowing anything about it). This is different than say, ClearCase, where the file is actually checked out on the server. So as Michael suggests, you don't really have to worry about it, you can always revert it locally. And if you just use Undo in VisualStudio, the file will again be marked as not modified.
What some of the other answers have hinted at: You don't "checkout" files with SVN. It sounds like you're coming from a ClearCase/SourceSafe mentality. SVN works on a different versioning model. When you "checkout" a working copy, you're pulling down the latest version of the files from the repository. You are free to modify any of them. Once you are done with your edits, you push, "commit" them back to the server.
I could ramble on and on, but instead of botching it, I'll just point you to the de-facto-standard SVN Manual - here's the first chapter which explains the versioning model that SVN uses.
Open the AnkhSVN Conviguration dialog (Tools->AnkhSVN->Configuration…) and set DisableSolutionReload to True.
There is also an option to do the opposite—to prevent it from automatically adding new files to SVN—that you can disable (setting AutoAddNewFiles to False).

SVN plugin for VS2008

I'm using VisualSVN with my Visual Studio 2008 and I have to run some sort of commit monitor in the tray area to see if the local copy of project is out of date.
I have two problems with that:
I hate to have it in two places, I want to see that as an icon in my VS,
The commit monitor software keeps an eye on several projects, when I work on project 1 (which VS knows about), I'm not interested in other projects.
I couldn't find any addons for Visual Studio to do that and was wondering if anyone knows about anything good.
Generally, you have 2 options (besides running commitmonitor as you already do):
run update before you start to change something
ignore it all and merge with any updates when you want to commit.
SVN's really designed around the 'wait until you're ready and merge it all together' model, as there's no guarantee that even if you update your working copy immediately before starting to modify it, someone won't commit changes before you've had a chance to commit. So, let the system do the work for you.
The ultimate alternative if you are worried about conflicts is to use the svn:needs-lock property which means you will have to get a lock on any file you modify before modifying it, and you won't be able to get a lock on a file someone else is modifying.
You might like to ask the VisualSVN people if they'd add an option to check the repository when a project is loaded by VS (or run AnkhSVN and implement this feature yourself).
Work has started in AnkhSVN in this direction, we started to implement the 'Synchronize View' that's also used in Eclipse/Subclipse. The things still missing are: Scheduled checking of the repository, and maybe a notification inside VS to tell you that something has changed.
Right now you can manually refresh this view to see local and remote changes (and merges which can be potential conflicts). Patches are welcome to extend this feature :-)
I'm assuming VisualSVN is your "server" (even if running on the same machine).
AnkhSVN is a good Visual Studio Integrated SVN Client.

Resources