GitHub is not configuring XCode project - xcode

I'm new to GitHub and I've searched a lot and tried this, this, this and this method but I'm still getting different errors. I've a project which has WatchKit extensions init. Now when I first created the project I didn't checked marked on Create a Git Repository. Now I want to upload the project to my git account. I have checked the following things:1: Xcode > Preferences > Source Control > And it is enabled.2: Source Control > Working Copies > Configure > Remotes > + > Then added the name and link created from my repo which I created online from my account. And it adds this automatically to all the three folders i.e. Project folder and Apple Watch Extension folders. But when I pust it from Source Control > Push it gave me this error Multiple errors occurred during the operation.3: I've tried doing it from terminal but after asking for my username and password I got remote: Repository not found. fatal: repository 'https://github.com/ibjects/My-App.git/' not found
So I have no idea where I'm doing wrong. And If I'm missing any information I'm ready to provide it as I don't know what else to mention.

Try to do it like this:
Go to the project folder in the terminal and run the command:
git init
Now add the remote URL :
git remote add origin your-url
Add everything to the git:
git add -A
commit the message:
git commit -m 'commit message'
push to the branch
git push origin master

Related

Github how to push Xcode project without old files and folders?

I finished an Xcode project and pushed it to github from Xcode 'Source Control' Menu. Then I changed the project name CountryBook to Countries. I Built project and ran. Everything was okay. Then I coiped project folder to desktop as a backup. Then pushed project again. Everything has messed up. Some old named folders and files still exist in repo. Then I deleted every directory and file from github repository. Now, backup version of project is working. But when I try to push it to repo, old files are still exist. I deleted 'origin' from 'Remotes' and created a new repo named 'Countries'. I pushed project again but it was same. A mixed version of old files and new files. When I clone the github version of project, of course it is not runnable. What sould I do and how can I push clean version of my project? I don't want to lose project.
This is Countries repo now:
This is my working project folder with correct content:
I would fix it via command line, lets assume you start from scratch:
Step 1 - prepare the working branch:
Clone the project
Navigate to root folder of the project
Checkout the main branch ("main", "master", or whatever it is)
Create a new branch you will be working with
git clone https://github.com/yourorg/yourrepo
cd yourrepo
git checkout main # or master
git checkout -b fixprojectstructure # branch name can be anything
Step 2 - clean project locally
Delete old project, old workspace, ensure the names in Podfile and Podfile.lock are fine
Build the project and ensure it's working
Step 3 - commit your changes:
# assuming you are in the root of the project
git add .
git commit -m "Some explanation"
Step 4 - push your changes:
I usually do it the lazy way: just run git push, which will show you the proper syntax to push remotely, something like
> git push
fatal: The current branch fixprojectstructure has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin fixprojectstructure
> git push --set-upstream origin fixprojectstructure
Enumerating objects: ...
...
remote: Create a pull request for 'fixprojectstructure' on GitHub by visiting:
remote: https://github.com/.../pull/new/fixprojectstructure
remote:
...
Branch 'fixprojectstructure' set up to track remote branch 'fixprojectstructure' from 'origin'.
Step 5 - merge your changes:
Basically just do what the line above is saying:
Navigate to https://github.com/.../pull/new/fixprojectstructure
Create pull request
Merge pull request to main (or whatever the initial branch was)
Note on the side: configure the gitignore file properly for your repo as well. For starters, follow the gitignore template to create a proper gitignore file, and then change it the way you need to.
For instance:
Usually, if you use cocoapods, you do not store .workspace folder and its contents in the repo. Instead it's generated using pod install command on each machine that needs it.
It's also common to exclude Pods directory from storing in the repo, although there are pro / cons arguments both ways.

Uploading Files from Laravel App to BitBucket

Here is what im try to achieve, I have a laravel app with a BitBucket repo in my laravel project public directory (public/repo.name).
Now what i want is to run, git add . git commit -m "Changes" and git push from my (public/repo.name) directory inside my laravel app.
I want the git commands to run when i go to lets say, http://127.0.0.1:8000/deploy this would only deploy whatever changes are in (public/repo.name)
Convert your Project to a Git Project
Open your terminal and navigate to the project root directory and run the git init command.
git init
git-init-laravel-project
Git init Laravel project
Git Add and Commit All Files
With the git init command we have successfully converted our project into a local git project. Although we have not yet added a git remote to our project.
As a second step lets go ahead and add and commit all the files to our local git repository.
Run the git add and git commit command on the project root.
git add .
git commit -m "First Commit"
The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.
The git commit command commits the staged snapshot to the project history. Committed snapshots can be thought of as “safe” versions of a project—Git will never change them unless you explicitly ask it to.
Git add and Git commit on Laravel project
Create a New BitBucket Repository
We are now ready to push our changes to a remote repository. But before that we have to create a repository where we can push our changes.
Login to Bitbucket if you already have an account or SignUp for a new account. On the left hand menu , Click on the + symbol to get the option of Creating a New Repository.
Create Bitbucket empty Repo for Laravel.
Enter a suitable project name and click on Create Repository. A blank repository will be created and you will be redirected to the overview page of the repo.
Now we can go ahead and make this repo our remote repo for the Laravel project.
Add Remote Repo and Push Changes
To add the repository you just created as the remote repo for your local Laravel project. Run the following command on your project root in terminal.
git remote add origin https://<repo_owner>#bitbucket.org/<accountname>/<reponame>.git
Replace the repo_owner and accountname in the URL accordingly.
git-laravel-remote-add
git remote add laravel
Now we can go ahead and push the changes to remote repository.
git push -u origin master
git-laravel-push-bitbucket
Git push Laravel project
If you see at source in your bitbucket repository. You should see your Laravel directory structure along with the files.

Error cloning a repository on Windows due to invalid chars in file name

When I want to clone repository that contain : (colon) in the path I got this error:
Clone succeeded, but checkout failed.
I tried to use git cli and git gui and I got same error.
Is there any solution for this problem?
If you want to clone from GitHub and if it's your repository, you can edit file content and rename them right on GitHub.
Click on the file you want to edit and you will see at the beginning of a file:
Click on the pen icon, rename file and below type commit message and commit. Then you can try to clone.
NOTE: If it's not your repo, try to fork it first then do the same steps mentioned above.

Xcode's "branches" master is an incorrect project

I want to put my current project on GitHub, but within my Source Control Navigator, it shows Branches. After double clicking the Initial Commit within master, it's showing a different project than what is currently open on Xcode.
Eventually I want to put the Xcode project on GitHub, but even if I try, it puts whatever is in master, which is incorrect. How do I fix this?
Edit:
It took a few Terminal commands, and then I was able to go to the Source Control menu >> Commit without errors.
xcrun git config --global user.email you#whatever.com
xcrun git config --global user.name "Your Name"
This put the correct version of the project on GitHub after I created a remove. Unfortunately, my master(current) is still incorrect and it includes that on GitHub for some reason.
Here are some screenshots of my Source Control Navigator. I only want first master displayed in the root folder or remote >> origin. Within the Branches folder, the only master shown is incorrect.
I moved a hidden ".git" (system) folder outside my main project folder. I then could create a new repository within the Source Control Navigator, create a new remote and the appropriate projects are visible in GitHub.

No submodule mapping found in .gitmodules for path '/ProjectName'

2 questions:
I created a project in xcode which has the following folders in it:
app_icon.png
app_icon#2x.png
FacebookSDK.framework
ProjectName
ProjectName.xcodeproj
I used git to create local repo and push it to a newly created github repo.
When I try to clone the repository using xcode I get the following error:
No submodule mapping found in .gitmodules for path '/ProjectName'
What is the issue? Is it the fact that I have FacebookSDK.framework folder in it?
After two attempts it miraculously was able to clone the project.. However, now when I try to commit anything in xCode the button says "Commit 1085 files" even though it shows 2 files changed...
u can run it :
git rm —cached /ProjectName

Resources