Push my App to Github using Visual Studio for Mac

Jassim Al Rahma 1,616 Reputation points
2023-01-05T14:01:28.06+00:00

Hi,

How can I push my App to Github using Visual Studio for Mac? I can't find this option.

Kindly help..

276518-screenshot-2023-01-05-at-60038-pm.png

Thanks,
Jassim

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2023-01-05T16:23:19.037+00:00

    You aren't in a Git repo so you don't have the option to push to it. In order to push changes to Github you first need to have a repo. In my experience it is easier to create the repo in Github first and then clone it into VS to do your work. You have gone the other way here.

    Use the Initialize Repository option to set up a local Git repo. You'll then need to push that repo to Github but I cannot say how to do that in VS for Mac. Ultimately what needs to happen is your local repo needs to be pointed to an existing user account in Github so it can create the repo in Github. That repo cannot already exist. Once that has been done then you will have the option to pull and push because you're local folder structure is now tied to a Git repo. The WIndows version of VS has documentation here to discuss how to do that.

    My preferred approach is to go to Github and log in. Then create your repo there. Then go back to VS and select Clone a repository and specify the URL to the repo you just created. Note that cloning requires an empty directory and the default name will match the repo name. So if you already have a folder that matches the name of the repo you cannot clone into it. You can use any local name you want though, Git doesn't care. Once you've cloned the repository locally then copy your files (and folders) into that new folder structure (the repo folder). You can then push your changes back to Github. The docs for the Windows version of VS are available here to discuss pushing changes.


  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-01-25T17:35:12.45+00:00

    while creating the repo in github first as suggested is easier, here are the directions for the other way around:

    [https://docs.github.com/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.