Xcode push workspace with submodules wrong repository on push - ios

I am trying to cleanup my workspace. I've created a separate reusable static library for the helper functions and another for the main project.
My directory structure is as follows:
SimplyStats/
SimplyStats/
externals/GoodStuffIOS
both the main project and the library project have been succesfully pushed/updated/committed to their respective bitBucket repositories.
But when i use XCode to push changes, i get the following dialog:
Notice that the Remote repository for the GoodStuffIOS project is at fault. The repository Organiser shows that the repositories are set up correctly. Whatever I do, I cannot fix that remote. How do I fix this?
EDIT: Here are the contents of my .git/config (starred the repo names)
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[branch "master"]
[remote "SimplyStats"]
url = https://************#bitbucket.org/**********/simplystats
fetch = +refs/heads/*:refs/remotes/SimplyStats/*
[submodule "externals/GoodStuffIOS"]
url = https://************#bitbucket.org/**********/goodstuffios.git

Navigate to the source folders, find the .git folder and navigate into it. There is a config file and that contains the urls of the remote repositories:
It should contain something like this:
[remote "origin"]
url = <remote-repo-url>
fetch = +refs/heads/*:refs/remotes/upstream/*
Verify, if it has the correct url. Try a git clone <remote-repo-url> in some temp folder.

Here's what i had to do to fix the problem.
Close the workspaces,
Go to Organiser/Repositories,
then for each relevant project, select in left column and remove by clicking '-'
quit XCode
verify/clean .git/config
verify/clean .gitmodules
reopen XCode
open workspace

Related

CDK codebuild project - put code in a subdirectory?

I have the following aws-codebuild Project which gets some source from a Github repo, then does some build actions.
const project = new Project(scope, "RaidoDbS3Import", {
vpc: props.vpc,
subnetSelection: { subnetType: SubnetType.PRIVATE_WITH_NAT },
securityGroups: props.securityGroups,
source: Source.gitHub({owner: "au-research", repo: "raido-v2"}),
...
I would like to change this to get the source code into a sub-directory, so that I can put some
data files in a sibling directory to the codebase.
I've looked around in the props for Project and GitHubSourceProps, but don't see anything that seems relevant.
My workaround will be to put the data files into an ignored subdirectory of the repository; but this questions is about "How can I clone the Github repository into a subdirectory of the codebuild current directory?"
Another workaround can be using git submodules for your data and fetch it while cloning repo.

Upload Code to VSTS Team Project

Is there any option of uploading code (from a zip file) to an empty VSTS team project?
I have used VSTS API(Projects) to create Team Project but i don't see any option there to push code to newly created VSTS project.
We can connect from Visual Studio to team project and check in code but i'm looking for some process which can add code to empty VSTS project without manual intervention.
any help/pointers would be appreciated.
First, you should uncompress zip file in an empty folder. Then commit and push the files into the new created repo.
Uncompress zip file:
string zipPath = #"C:\a\1.zip"; \\zip file you want to uncompress
string extractPath = #"C:\a\2"; \\empty path to extract files in zip
ZipFile.ExtractToDirectory(zipPath, extractPath);
Add the uncompress files into git repo:
For git repo
You can use REST API to add files and push to git repo.
Or you can use System.Diagnostics.Process to execute git commands, such as
ProcessStartInfo gitInfo = new ProcessStartInfo();
gitInfo.CreateNoWindow = true;
gitInfo.UseShellExecute = false;
gitInfo.RedirectStandardError = true;
gitInfo.RedirectStandardOutput = true;
gitInfo.FileName = #"path to git.exe"; \\such as D:\program files\Git\bin\git.exe
gitInfo.Arguments = "git remote add origin https://account.visualstudio.com/project/_git/repo";
gitInfo.WorkingDirectory = #"C:\a\2"; \\path where extract files in
Process gitProcess = new Process();
gitProcess.StartInfo = gitInfo;
gitProcess.Start();
string stderr_str = gitProcess.StandardError.ReadToEnd();
string stdout_str = gitProcess.StandardOutput.ReadToEnd();
gitProcess.WaitForExit();
gitProcess.Close();
For TFVC repo
You can use the commands.

How to use Git source control in Xcode 7.2?

I am using Xcode7.2 and i created new project with “Source Control- Create Git repository on” . However this project is created but automatically show popup message like this “Couldn’t communicate with a helper application”.
After this project is created I see the local branch is missing and I can not commit files ("Commit files" does nothing).I also noted following point like When Xcode is started the following error is presented: "Couldn’t communicate with a helper application". How to solve this issue ? Please help me.
Try to create git repository from terminal if you haven`t created it when creating project.
Remove git repository if you have created. (Open Terminal go to git repository and remove it by rm -rf .git )).
Go to your XCode project (where .xcodeproj file is) and create git repository by typing this command git init
Add files you to your git repository. (git add --all)
(If you want to ignore some files you can create .gitignore file in this folder and list files which are you want to ignore)
Commit it. git commit -m "First C"

xcode project name and directory change/ Git cannot see old revisions

I am in Git madness right now!
I changed the name of my xcode project by clicking on the project name in xcode and changing the name from oldproject to newproject.
That changed the name of the project everywhere except for the folder (in finder) containing the project files. My OCD kicked in and I changed the directory name where the project files reside. I then had to manually point xcode to the location of the project files (by selecting the project in xcode, opening the utilities window and updating the "Full Path"). The app still works fine.
Now comes the Git part. I checked git status in Terminal and it said that I needed to add the directory newprojectdirectory/. I did and then did a commit. And now I can do commit and use Git as normal going forward but I can't see any of the oldprojectdirectory/ revisions.
Any thoughts?
Thanks
If you want to track history beyond rename, it's normal.
git doesn't track history of renamed file like other files.
it is just like 'remove & add newly'
but, you can use --follow option
git log --follow rename-file
and you can see history beyond rename, however it works only for a file.
use that:
git mv -f [file-original] [file-renamed]

Error : Fatal: Not a git repository (or any of the parent directories): .git

When I try to put images into the Resources folder of my project, I got this message :
fatal: Not a git repository (or any of the parent directories): .git
How can I fix that?
Had the same problem. I copied a project then tried to delete files.
If you want to be able to edit the project, type git init folder in the terminal. This will re-initialize the git in your folder.
Go to Organizer->Repositories and remove the Corresponding repository.
Faced the same problem in Xcode 4.6.1 after moving my folder and xcodeproj file. Here's what works for me:
Delete corresponding repository in Organizer
Close Xcode
Delete the original .git directory
git init in the new directory where you placed the folder and xcodeproj file, and do an initial commit
Start Xcode
In order to do anything in Git, you have to have a Git repository. This is where Git stores the data for the snapshots you are saving.
so just go into your project directory let say you have a project name test_project just go into that directory and type the command
git init
and this will work.
Perform these two steps in Xcode 11, to get rid of this error:
In the menu, select Source Control > Create Git Repositories.
Click on the Create button.

Resources