skip to Main Content

`Please excuse my ignorance, I’m pretty new to GitHub. I’ve programmed before but this is my first dive into programming in Swift/Xcode and I want to start practicing pushing all of my changes to GitHub to beef up my profile.

I have created a new Xcode project, and through Source Control in Xcode I logged into GitHub and created a new remote repository. I created the repository after already programming a few other basic views and changing ContentView, but the initial commit to GitHub only shows the stock ContentView file that’s created when making a new project. None of the other files or assets show up either.

Do I need to go somewhere and update the path? After pushing the project repeatedly using Source Control none of the other files have been added to my GitHub repo. I’ve tried a couple different things online and also tried making an identical project and making a new repo for that but got the same issue. I have basic experience with the terminal so I’m not opposed to using that if necessary, I’m just not 100% sure on the git commands. I’m pretty lost so any help is appreciated.`

I’ve included some pictures to show what my ContentView and PreviewAssets look like in Xcode, and what’s showing up in GitHub.

Xcode files

ContentView github

previewContent github

2

Answers


  1. You did not explain what you did, so I will tell you what you should do.

    1. First you say Source Control > New Git Repository if needed.

    2. Then you switch to the source control navigator, switch to Repositories, open Branches, select main, and choose Editor > New Remote.

    3. Then you use the GitHub web interface to look at your remote and you will see that all the files in your project are there.

    Now, having said all that, I say: don’t do any of that. Xcode Git support is atrociously bad. Use the command line in the Terminal exclusively.

    Login or Signup to reply.
  2. Try this:

    git remote add origin <repository-url>
    git push -u origin main
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search