Xcode 6.2 won't load remote git repos - ios

I need to keep my Xcode project in 2 remote repos. Below are the steps I took.
Created an empty folder in my Mac.
Added a .gitignore file.
Created a project using Xcode 6.2.
Created a repo on Bitbucket.
Created a repo on Github.
By Selecting Source Control -> Working Copies -> Configure -> Add Remote, I added two remotes.
Then by selecting Xcode Preferences -> Accounts, I filled up the user credentials for each account.
Then I went to commit the initial changes of my project by selecting Source Control -> Commit, it keeps showing Loading remotes... in the remote selection drop down but it wouldn't load.
Am I missing something here? Any steps I missed? I also tried adding them individually to see if it's something with one of the remotes but that didn't work for both of them either.
I opened the git config file on TextEdit and this is what I have there.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "bitbucket"]
url = https://Isuru-Nanayakkara#bitbucket.org/Isuru-Nanayakkara/coolproject.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*
[remote "github"]
url = https://github.com/Isuru-Nanayakkara/CoolProject.git
fetch = +refs/heads/*:refs/remotes/github/*

I was on a detached head (a commit made by another developer) hence there was no matching commit on my branches from my repo. As a result I was getting this:
How I got myself into a detached head? Simply put I did something like git checkout c10847ae6708fadc73d451a68e2dsdf30dbbabd86

Okay, after some fiddling I was able to get it working. Again here are the steps I took.
First I committed my changes locally. I did this through Xcode.
Since the remotes weren't showing in Xcode, I turned to the Terminal's aid. First I pushed to Bitbucket's repo. Initially I tried with git push bitbucket but that would give me an error. Upon searching I found out that I need to set a default remote for my local repo. So I ran the following command and the changes were pushed to the Bitbucket's repo successfully.
git push --set-upstream bitbucket master
Then when I tried to push to the github with git push github, I got this new error ![rejected] master -> master (fetch first). Even after pulling the latest from Bitbucket, I'd still get this error. So in the end to get past this, I ran the following command and force pushed the repo to Github as well.
git push -f github master
After that now I can do my changes in Xcode and push to both remotes from Xcode itself. Now the remotes appear in the drop down! Maybe this is an Xcode bug(?).
Note: If the steps I took are wrong or if there is a cleaner or more right way to go about this, please post your answer. I'm still very much open for suggestions.

Related

how to delete duplicate local branch in git which does not exist

I searched for similar questions posted here and on the web, but none of them refer to my case.
In some way, I accidentally created a duplicate local branch as you can see in the attached screenshot. My guess is that I created it somehow when I was working with git stash with multiple stashes.
This duplicate branch appears only locally. And moreover, the command git branch in this repo returns only the master branch.
How can I fix this and remove the duplicate local branch? I do want to keep the tags in their place (and I do see them in GitHub so they indeed exist in origin/master branch although they do not appear here in origin/master). Thank you for your help
Editing due to comments:
Before all that mess I accidentally caused, I only saw a single line in the git graph (the blue one) and the tags appeared on it. there was no parallel line next to it showing the same commits. BTW, I cloned the repo to a new location and there I see what I expect - a single line with the tags appear on it. Moreover, I can't push to git from VSCode, but I do succeed in pushing from gitbash, this makes me wonder whether this is some bug in VSCode.
git log --all --graph --format=oneline --decorate prints the expected proper graph, with no duplication:
For other people facing the same issue.
I'm not sure why it happened but it was caused by the tags created using the git-graph extension in VSCode.
To fix this: manually deleted all tags locally only and then fetch them back using git fetch --all --tags.
Note that if the tag was also pushed separately (possibly create/push by another collaborator), a git fetch --tags would bring it back.
While it was not the case for the OP, the command "Git: Delete remote tag" can help, and is introduced with VSCode 1.75 (Jan. 2023) with PR 170415 from the 2020 issue 104845.
This is available in VSCode Insiders today.

github is not the same after push

I'm wondering how this is possible.
I made quite a bit of changes to my rails project (deleted some stuff, edited files, added files, ...) as I implemented a whole new design.
And now I want to commit my project and push it to github
git merge new-view
git add .
git commit -am "implemented the new design"
git push origin master
Now when I pulled the changes on another computer I noticed that not all of my features were working. (for example the image slider wasn't functioning).
When I go trough the files, it looks like all the changes I made are there, but I must be missing something because both projects are not behaving in the same way!
Even when I clone the project again from github (on the original computer with the working projectfolder), the feature still doesn't work.
git clone projectname
Now in my old folder I can't push any other changes as status tells me that my branch is up to date with origin/master
git status
I figure that I can just delete the github project and upload it again, but that's obviously not the way this is supposed to be done.
Any ideas what could've gone wrong?
Make sure that no important files are being ignored- see this answer
Make sure everything is truly committed. git status and git status --cached
Make sure any databases are initialized, migrated and populated with the same data.
Check browser caching.

Pushing to github issue

I have a project which was bound to the remote server on github, but somehow it stopped working, so I deleted the remote origin folder through the Organizer and reconnected fresh.
But now, I have changes made to the project that are not yet pushed to the remote server.
I am trying to push, and I get the error:"Your working copy is out of date. Try pulling from the remote to get the latest changes, then push again.".
But this is not what I want to do, because it will erase all my local changes!
Actually, the error message is incorrect, because my working copy is newer than the version on the remote.
Please advise.
Thanks!
Usually when I forget to pull, git does not overwrite my local changes.
Still it is worth being safe. Store your local commits as a stash, then pull and apply the stash.
See this stack overflow answer here:
git stash
git pull
git stash pop

Remove Travis CI old builds

This is my first day using Travis CI. I made some mistakes, I've tried removing and adding the repository again, but Travis CI build history is still there, with broken links for old commits.
Any chance to remove those old builds?
You can use the travis command line tool
Login first using travis login then you can do the following
LAST_BUILD_NUMBER=68
for i in $(seq 1 $LAST_BUILD_NUMBER ); do travis logs $i --delete --force ; done
This will remove the "logs" so there's no information aside from the header and any confidential information will no longer be visible.
There's no way for the user to remove builds, but if you really want them removed I think your best bet is to email support (support#travis-ci.org) and ask them to remove it manually.
Per https://twitter.com/travisci/status/557932883571392512
Since at least 2015/01/21 you can now delete [the log] from the web UI:
As henrikhodne, build deletion is not possible.
From https://github.com/travis-ci/travis-ci/issues/877 (mirror) where the issue was raised:
Closing this issue for good, as this isn't on the roadmap for the near future. (Jul 23, 2015)
You can click on the Remove log button
Another way to PURGE EVERYTHING which results in:
removing all the build history from Travis CI
removing the repo from Travis CI
removing the repo data from GitHub (all issues, PRs, wiki, everything)
removing all the dangling commits from git push -f
First make sure you have screenshots/backups/... of all your settings in Travis and in remote repository + that you have a 1to1 mirror of your remote repository (meaning ALL your branches properly downloaded to the local repo). That should be possible just with git clone, git fetch and maybe even git checkout to each of the branches, so that you have all the history available locally (correct me if I forget some step).
Then you want to go to your remote server e.g. GitHub and delete the repository (Settings - Danger Zone - Delete this repository). All your issues, PRs, wikis, any settings are gone now. Then create the same-named repository on GitHub again (do NOT! initialize it with anything, no license, no readme, no nothing).
Now all the dangling commits which would be cleaned locally via git gc are gone from the remote repo (stealthy GitHub links begone!). Anything that should be the bare repo.git folder should be overwritten (unless GitHub isn't doing something silly).
Proceed and go to Travis CI profile:
https://travis-ci.org/profile/<username>
Press Sync account under My account and check the Travis repo. All the settings and build history should be gone now too.
Now either remove the GitHub repo and resync again or proceed with the restoring:
git push -u origin <branch name> # repeat for each branch
Go to your settings backups (e.g. screenshots) and set everything the way it was before.
I was able to wipe the Travis build history simply.
I'm logging into to travis-ci.org via my Github account.
I went into travis-ci-org, and hit the + to show all repositories:
Then I turned off Travis CI for the repo in question by flipping this toggle:
In Github, I renamed my repo.
Then I hit "Sync account" in the upper left.
For my final step, I flipped that toggle back on under the new repo name.
Voila - no Travis history. I triggered a build manually and now everything is clean and clear.

Rails: Rubymine: GitHub

I can't seem to figure out how to commit my files to GitHub.
I am using RubyMine 4.5 on the MAC
I have git set up locally
I have a private account on GitHub
From the RubyMine Preferences, I have my GitHub credentials properly set up (and acknowledged as such by RubyMine), but it did not give me an option to select a repository on GitHub.
How do I commit file to the GitHub repository? There are too many CVS and Git menu items in RubyMine.
PS: I've read the online help sections (the only thing available to me), and I followed the instructions in the GitHub integration, but the directory I'm trying to commit is failing to push to GitHub, with RubyMine telling me that there was nothing to commit. This is the first time I use RubyMine for GitHub. Nothing about this on StackOverflow.
Okay, I think I've recreated your situation locally and it appears that RubyMine has terrible support for managing remotes. If you create a Git repository locally, then (separately) create a repository on GitHub, there's no obvious way to marry the two from within RubyMine.
Basically, you need to set up GitHub as a remote for your local repository from the shell, and once that's done then RubyMine will be able to push as normal.
Please note that the below instructions assume you want to overwrite your GitHub repository with the full history from your local repository -- If your GitHub repository has data that you do not want to lose, do not execute these commands! See Below.
Open up Terminal:
cd /path/to/my/project/root
git remote add origin https://github.com/yourusername/yourrepo.git
git push -u origin +master
Now, RubyMine should be able to push to your GitHub repository via VCS > Git > Push
If your GitHub repository has already been committed to and you don't want to lose those changes, you'll need to either create a new GitHub repo or clone your GitHub repo into another folder and merge your local repository into the clone.
This can be avoided entirely if you're trying to push your existing local repository to a new GitHub repo: Simply use the VCS > Import into Version Control > Share project on GitHub option and use the dialog to create a new GitHub repository.

Resources