Visual Studio Project - Git Gui Problems - c#

i have a little problem using gitgui for a Visual Studio project...
there is a .gitignore file in the original Repository to exclude temporary files / the obj folder.
I tried cloning (Full Repository Clone) to my Home Folder from a network drive (Server Drive) - changed something. Tried to Commit it - it still commits the obj folder, i tried deleting the obj folder and get the error:
Pushing to I:/VPR/GIT/BrainFAQ_V3
To I:/VPR/GIT/BrainFAQ_V3
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'I:/VPR/GIT/BrainFAQ_V3'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Maybe anyone can help me how to fix this.

Follow below steps
Connect Visual Studio with Git Server
Clone in Local folder of your system
Open the solution that just got retrieved from Git Server to your local system
Do the changes and build the application.
Delete the folder you do not want to commit in Git from Visual studio, your .sln file of project will get changed accordingly or can use .gitignore and specify the files that you do not commit to Git Server. For More refer https://help.github.com/articles/ignoring-files/
Now, commit and push the changes to Git Server
Step 6 will be success only if there is not commit happened on master branch from the time you cloned the application.

Related

Resync local project to GitHub repository in Visual Studio

I have an old project that uses GitHub as the git repository.
I've just made some changes to that project and now I need to update the repository.
But, after buying a new computer earlier this year, Visual Studio no longer knows about any connection to that repository.
So how can I fix this without losing any of the changes I just made? My two primary options given are Create Git Repository and Clone Repository. I don't think I want either of those.
Apparently, the hidden .git folder is missing in the project, which identifies a folder on the disk as git repository. Without this folder, no git commands will be available (whether from the command line or any GUI tool).
I suggest the following steps to resync the project to github:
Check out the project from github to a new folder
Set the checkout folder to the branch where the project was when the .git folder was lost (since it's an old project, you can probably take master)
Copy the contents of the existing source folder into the checkout folder. Make sure not to copy any hidden .git folders if there are still broken leftovers.
Verify and commit the diff.

Git does not exit cleanly (exit code 1) when I try to commit Visual C# Project file

I have my ASP.NET MVC Project Repository in GitHub.
By using Git Extensions I have taken the Clone into my local machine. I have added new Folders / .cs files / .aspx files etc.
I have Committed all the new files using TortoiseGit Commit by Right Clicking on each folder/files successfully.
Since I have added new files/folders, then I have to commit the Project file (*.csproj), when I try to commit I got the error:
"did not exit cleanly (exit code 1).
What can I do now? should I open the Project file directly in GitHub repository and update it from my local directory project file? like, copy and Paste!
It will provide any issue later on! let me know if any have this issue.
Maybe the file is taken by another process: try the same commit after closing other windows.
If not, check also the command-line alternative, after installing a Git for Windows (2.21 at the moment)

nothing added to commit but untracked files present

I am able to add one separate file , make changes and the change is reflected in Team explorer in visual studio. I am able to push file to repos successfully. But When I try to add one folder , the files and subfolder present under the parent-directories are not reflected for changes in visual studio.
Kindly let me know if I should change any settings before making this commit
Step By Step Process
1. I am creating new repositary in azure artifacts
2. I am opening my visual studio --> Team explorer --> connect to server .
3. I have connected to my server and cloned it to my local . local repo is created
4 Now I copy my workspace and paste it in local repository. My workspace contains many folders and sub folders are present in the workspace.
5. In visual studio --> changes --> I am able to see only main folders or parent directory. (sub folders and files available in subfolders are not available in changes).
6. I committed and pushed the code.
7. Now in artifacts in repos , only main folder or parent directory is present, sub folders are not available.
According to your description for detail steps, there is nothing business with Azure Artifacts. Which used for Code once and share packages across your organization. Host your private Nuget, npm, and Maven packages with Azure Artifacts for more reliable, scalable builds.
Are you just talking about version control. There should be something wrong with your source control binding.
Do not directly copy and past files.
Suggest you to follow the official tutorial to add files in server.

GitHub Commit Error: Permission denied fatal: Unable to process path ~/App_Data/aspnet-MyProject.mdf

I am attempting to commit an update to my ASP.Net MVC project using GitHub integration in Microsoft Visual Studio 2017.
I am working on Code-First Migrations. After my previous successful commit, I performed the following commands on the Package Manager Console in Visual Studio:
PM> Enable-Migrations -ContextType ApplicationDbContext
PM> Add-Migration AccountNumberChanges
PM> Update-Database -Verbose
Once this was done, I tried perform a commit, but I was getting the following error:
Git failed with a fatal error.
error: open("MyProject/App_Data/aspnet-MyProject-
20171110110346.mdf"): Permission denied
fatal: Unable to process path MyProject/App_Data/aspnet-
MyProject-20171110110346.mdf
The above commands have added the .mdf file to the project's App_Data folder.
You shouldn't be committing mdf files to git - they are data files for your database. git is likely complaining because the file is in use and it needs read access to be able to send the data to the repository. The simplest solution is to remove it from git with git rm. For example, at the command line:
git rm MyProject/App_Data/aspnet- MyProject-20171110110346.mdf
If you still want to add your mdf files to git.
I was having some trouble with this too, so what I found out is:
If you're using Server Explorer from Visual Studio, just right click on your Connection name in the Server Explorer window and click on Close Connection.
May be this will help someone in the future. The problem is that you still have the file connected to your Local DB in the Server explorer and the file has handles in use which blocks the commit to occur.
What I actually did was
Right click the Local Db or the database to which the file is associated and
choose Detach option so it can release any handles from the .mdf or .ldf files.
PS: you can attach the database anytime you wish to except during the commit timeframe.
Once the database is detached, the commit works without any problem. Try this and it works most of the time.
This just happened to me with a fresh install of VS 2019 on an older project that did not previously have this problem (maybe my ignore list is not correct). There was a MySQL db.lock file that was causing the problem.
In Team Explorer, right-click the file and select "Ignore this local resource".
worked for a quick fix (not saying it is the perfect or correct way but it worked)

ASP.NET Service.exe isn't picked up by GitHub

I'm using the GitHub application for windows to transfer my code between my local and the server. I've made two ASP.net services thus far, which work fine- however my latest c# service's .exe and related files aren't picked up by the GitHub app, meaning when I pull from the server, the .exe of the service isn't available to allow installation. (From the debug folder, the installation.log file is picked up, but not the .exe and some attached .dlls)
I've reviewed the directory, and there's no git.ignore instructing the app to ignore it.
Furthermore, when I make changes to my existing services, their .exe is updated, and picked up by the app and allowed to transfer.
Why doesn't my new service's .exe and related installation files get picked up?
I'm using VS2008 (Don't judge me, it's comfortable).
Any advice appreciated, thanks.
Hey actually something like that happened to me once with the Github for Windows. Well at least for what I understand is that the file doesn't get added to the remote git repo.
I would start the git shell:
Open the repo you're working on >> Tools and Options (Button) >> Open a shell here
There try this to see if file is added to the repo:
git ls-files yourService.exe --error-unmatch
if not try figuring out if it's ignored some how:
git check-ignore -v -- yourService.exe
if you get nothing, it's not ignored. If you do get output it is ignored somehow.
So first if it's ignored force add it manually:
git add -f yourService.exe
Now commit and push it to the server. In case you've never done this manually use:
git commit yourService.exe "This is a commit message for one file only..." (For commiting on a specific file)
or if you want to commit on all changes and added files use:
git commit -a yourService.exe "This is a commit message for all changes and added files..."
In the case it's not even ignored you may have merge problems with the server, in that case you have to to force push to server by using: git push -f <remote> <branch> (e.g. git push -f origin master) which is very well explained by Trev Norris here: Force "git push" to overwrite remote files.
After that it should be solved, I kinda stopped using Github for Windows because of these ignore issues (which might be purposely developed but I do it manually and use www.github.com for visuals).
Hope this helps you.

Categories