Capistrano 2 -> 3 git deployment differences? - ruby

In my previous capistrano version 2 deployment of an app, I always got access to git on the deployed side with .git present. This was handy when in a pinch we need to make a couple of tweaks server side and push them back to version control.
Now that we're moving to capistrano version 3 we've been missing the .git folder and obviously no longer can issue git status, etc. on this deployment.
Is there an option I'm missing that has changed the functionality of cap 3 that removes git vs from a project upon deployment?
It does indeed USE git for each deployment, but it's obviously doing something after the deploy to remove .git, etc.

You can find the .git directory in #{repo_path} variable.

Related

The working copy “Pods” failed to commit files - Realm Errors

I am unable to commit my Xcode project changes to Github due to the following error. As you can see below, it's related to Realm. I updated the pods recently. Any advice on how to fix this.
Assuming you want to commit your Pods directory to Git, which ensures that your projects can be always compiled when you checkout a certain revision without having to run pod install before, then you could reset what you have in your staging area in the Podsdirectory by running the following commands in your project directory:
git rm --cached -r Pods
git add -A Pods
(Disclaimer: You can lose data by running such commands. Please familiarize yourself with what they mean if necessary, so that you don't delete by accident what you want to commit.)
Alternatively, you can add the Pods directory to your .gitignore file. This will ensure that you can't commit the Pods directory in future, but it will be necessary that pod install is run after changes to the Podfile.lock when e.g. switching branches, collaborating and on CI.
You can achieve that by executing the following command on the shell in your project directory:
echo "/Pods" >> .gitignore
After doing that, you need to commit the changes to your .gitignore to your repository. Furthermore I'd recommend to make a dedicated commit to your repository where you remove the files under the Pods directory. This will then affect only the repositories contents and not your local checkout.
The CocoaPods Guide "Using CocoaPods" has a chapter "Should I check the Pods directory into source control?", which discusses in length the advantages and disadvantages of that:
Should I check the Pods directory into source control?
Whether or not you check in your Pods folder is up to you, as
workflows vary from project to project. We recommend that you keep the
Pods directory under source control, and don't add it to your
.gitignore. But ultimately this decision is up to you:
Benefits of checking in the Pods directory
After cloning the repo, the project can immediately build and run, even without having CocoaPods installed on the machine. There is no
need to run pod install, and no Internet connection is necessary.
The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.
Benefits of ignoring the Pods directory
The source control repo will be smaller and take up less space.
As long as the sources (e.g. GitHub) for all Pods are available, CocoaPods is generally able to recreate the same installation.
(Technically there is no guarantee that running pod install will
fetch and recreate identical artifacts when not using a commit SHA in
the Podfile. This is especially true when using zip files in the
Podfile.)
There won't be any conflicts to deal with when performing source control operations, such as merging branches with different Pod
versions.
Whether or not you check in the Pods directory, the Podfile and
Podfile.lock should always be kept under version control.
In addition, you might want to check, whether your .gitignore can be improved. I can recognize from the screenshots for example that you have a xcuserdata directory in your Xcode project, which Git doesn't ignore. Those are user-specific configuration files and don't necessarily belong into a repository. If you collaborate with others, ignoring those reduces the size of the repo and the noise in pull requests and makes change sets easier to review. But as above it is ultimately up to you, whether you want to check them in or not. GitHub hosts a crowd-sourced repository with file templates for a wide variety of languages. Their Objective-C file might be good starting point for you.

Should I use Heroku git for source control in addition to production code?

I have created one application using NodeJS, Angular and Express which I want to run at Heroku. Now, Im using Grunt to build the code that are placed in the dist folder and is ready to be deployed and run on Heroku. This would be done by pushing the dist folder in the Heroku git repo.
Now, should i push my source code in Heroku git as well?
If so, how should I seperate it from dist-folder repository? For instance, I dont want Heroku to run npm install each time i push changes to remote repo. And dist folder should not be part of the source code folder in the repository since it is auto generated.
Using a git repository is the only way to push changes to heroku. So yes it is mandatory. Having said that here is what they have to say about it.
Heroku provides the git service primarily for deployment, and the ability to clone from it is offered as a convenience. We strongly recommend you store your code in another git repository such as GitHub and treat that as canonical.
Again there is no way to stop them from doing an npm install on each push. Here is a quote from their getting started guide
Heroku recognizes an app as Node.js by the existence of a package.json. Even if your app has no dependencies, you should still create a package.json that declares a name, version, and empty dependencies in order that it appear as a Node app.
But I suppose that you could download all the dependencies of your app locally, not specify in package.json, push it along with rest of your application and you might trick heroku into thinking that there are no dependencies. Have not tried it myself though.
If you don't want dist folder to be a part of push simply gitignore it.

Running Pow on GIT repo branch

I've checked out my Ruby project from GIT and I've installed pow to run it on a friendly URL from my browser.
We've got a stable working version of our app running in our GIT 'master', but now I want to run our development branch on the same pow URL. I've already switched the working branch to our development branch 'redesign', but the Pow URL is complaining with error in the screen.
My question: Is it even possible to run POW on a directory using a GIT branch other than 'master'?
Yes, but you might need to restart pow to force it to refresh the code.
There's two ways to do this:
touch ~/.pow/restart.txt
Install the powder gem. That allows you to run powder restart on your app directory.
Also, you might want to run bundle on your project directory too, as dependencies might have changed in the new branch (hard to tell without more information.)

How to restore version control in XCode?

I have just recently backed-up my XCode C++ project on my pendrive, using
rsync -avu
Since then, the version control for my project is grayed-out on every files, I can modify the files and not see the "M" nor the "A" sign. The only files still having version-control working "shared" files for which it works correctly. (Those shared files belong to a different project called "Shared").
I have tried git commit -m, git add . and even git init where the files were. Nothing worked.
Can you please help restoring version control for my project?
UPDATE:
Answers for the questions in commens (and answers):
my git repository is on my local hard drive.
I went to the Organiser-repository pane in XCode and I see my recent git commit -m "sth" as "sth" az a commit. I have a single branch: master.
Im not sure what command would be good to test git, as my commits work (theoretically).
I have a folder named .git in the project folder.
git log is working, showing the same as XCode Organiser-repository pane.
I think the XCode just can't synchronise with the git for some reason, and I don't know how to correct that.
First off, this is not an answer that will fix your problem, I just try to provide some help that might get you closer to a diagnosis.
Git stores its files in a folder named .git. Check if this folder is present in your project. If it's not then your Git repository is gone.
Next, try some basic command such as git log. For this to work, you must first cd to your project folder (or a subfolder thereof), because whenever you run a Git command it will look for the .git folder in the cwd or a parent folder. If git log does not work then your Git repository is broken in some way. Someone else will have to step in to further diagnose the problem, as I am no expert on this subject.
Finally, you should also check whether your rsync command has really sync'ed your project's .git folder with the backup's .git folder. Use this command:
diff -rq /path/to/project/.git /path/to/backup/.git
If there is no difference (as I would expect if rsync has worked correctly) then the problem with your Git repository is both in your project and in your backup. If there are differences then it might be worthwile to try your next steps on a copy of the backup (it should be fine to make the copy in the Finder).
Good luck.

Moved file location in Xcode 4, can't push to Github

Git newbie here. Using Xcode 4.3.2. Had to move my project file directory. Commit still works fine but when I do a git push, I get Everything up-to-date, which is incorrect.
How do I get back on track?
Thanks
Check also if you are not in a DETACHED HEAD mode.
That happens if you checkout a tag or a file (see git checkout illustration in gotgit):
That was the case for the XCode question "Git (no branch) in xcode"
When you moved the project directory, did you move the .git folder with it? An easy way to check is to run git log and see if all of your previous commits are still there.
If you moved the .git folder with the rest of the files, then your remotes would still be setup correctly.
If it really isn't hooked up for some weird reason, try running git remote show origin and check to make sure that the url is correct and everything.

Resources