Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I connect my existing Visual Studio 2022 project to an existing github repository?

xarzu

IS-IT--Management
Jan 16, 2012
19
0
1
US
I set up a github repository to match the project I am working on in Visual Studio 2022. I did something wrong and only the project file exists. I followed a tutorial. But the tutorial was disappointing and the instruction was to drag the content of my project and I suppose I only uploaded the project file.

That was then. This is now. So far this is what I have done. In Visual studio I opened a command window by click on CTRL + `. THen using the.git file and its location from my github repository, I typed at the command line:
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS C:\source\repos\SharePointListCreation> git clone https://github.com/Wm-M-Thompson/SharePointListCreation.git
Cloning into 'SharePointListCreation'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (3/3), done.
PS C:\source\repos\SharePointListCreation> ^C

That is the result if me putting "git clone https://github.com/Wm-M-Thompson/SharePointListCreation.git" at the command line window inside Visual Studio.

I asked AI and this is what they suggested:

ghitub ai question.png
As the case sometimes is, following the direction of AI does not result in positive results. When I right-clicked on the solution, the option to "Add Solution to Source Control" did not appear. Instead, I got this:


git hub 01.png

Now, when I click on this, option to "Create Git Repository..." I am not able to set up a GitHub connection because the system recognizes that it already exists and the "Create and push" button is greyed out, but when pick "existing remote" I am able to make the connection and (supposedly) push my code to github.

git hub 02.png

git hub 03.png


This seems to work. There is a notice that appears in the IDE in the bottom left that suggests that the files is being uploaded to the github repository.

git hub 04.png

On github there seemed to be the files there but, at the same time, when I look closer at the content, the files were NOT there. Anyway, here is a screen shot of what looks like the files ARE there:

git hub 05.png

So I uploaded the .cs and .sln files by hand. Now, how do I do periodic pushes and updates to github from my Microsoft Visual Studio 2022 IDE?
 

Attachments

  • git hub 01.png
    git hub 01.png
    48.4 KB · Views: 0

Part and Inventory Search

Sponsor

Back
Top