Here a step of installation in heroku web hosting website:
Track your application with Git
If you’re already using Git with your application, skip to the next step. If you’re not yet using Git to track your application, run this:
$ cd PATH/TO/MY_APP
$ git init
Initialized empty Git repository in .git/
$ git add .
$ git commit -m "new app"
Created initial commit 5df2d09: new app
44 files changed, 8393 insertions(+), 0 deletions(-)
when I cd to the PATH/TO/MY_APP
there's no such dictionary, So I guess it's a custom path which should add to the user path file manually, Is that right?
It means path to your app, so if your app is in /usr/bin/myapp, than it is "/usr/bin/myapp".
Related
I have an app that i am working on that i did not set up and i don't have communication with the dev's that did. I have pushed up to it in the past but today for some reason i was not able to. Rails 4 with capistrano. When i looked at the app directory on the server i could find the .gitignore but no .git folder. I did a "git init && git remote add git_ssh_url" but it didn't work. I was thinking about a git clone but i have no clue what that will do to the app. The app is used daily at a company and i'm sure they wouldn't like me screwing it up :) I'm at a loss, Any help is appreciated.
**
Edit
**
So i realized that there is a staging server set up on the same droplet as well and the code to deploy to each is nearly identical. I had no problems updating the staging server
Here is the error code:
refreshing local cache to revision 4ea064e4826a9880c6bac3e0a2689b688e223911 at /var/folders/qb/6fdgzljs1r9ddgkvqk1ky0y40000gn/T/mpm
executing locally: cd /var/folders/qb/6fdgzljs1r9ddgkvqk1ky0y40000gn/T/mpm && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 4ea064e4826a9880c6bac3e0a2689b688e223911 && git clean -q -d -x -f
fatal: Not a git repository (or any of the parent directories): .git
command finished in 9ms
shell command failed with return code pid 97172 exit 128
So the solution i came across while asking a friend was that somehow the temp cache file that capistrano creates locally here (this path was pulled form the error that i posted above) :
/var/folders/qb/6fdgzljs1r9ddgkvqk1ky0y40000gn/T/mpm
was throwing the error. At some point there must have been an interrupted deploy that messed up that file. When i ls -la the mpm file above there was a .git file but for whatever reason it wasn't recognized.
The solution was to
rm -rf /var/folders/qb/6fdgzljs1r9ddgkvqk1ky0y40000gn/T/mpm
and rerun the cap production deploy command and it rebuilds the temp cache file and deploys the code.
Hope this helps someone!
I'm new to rails and git. I have a rails application under ..../myapp that I would like to deploy using capistrano. I followed the steps described in "Agile Web Development with Rails". To put the application under version control, I did the following:
1) Put my application under version control:
$ cd myapp
$ git init
$ git add .
$ git commit "..."
That all went fine, it created a .git directory under myapp/
2) Created an empty repository on the server:
$ mkdir -p ~/git/myapp.git
$ cd ~/git/myapp.git
$ git --bare init
$ Initialized empty Git repository in /root/git/myapp.git/
3) Created a public key
$ ssh-keygen -t rsa -C "myemail#myemail.com"
$ Your identification has been saved in /root/.ssh/id_rsa.
$ Your public key has been saved in /root/.ssh/id_rsa.pub.
$ The key fingerprint is:
$ d2:16:76:e0:4c:71:de:de:4b:d3:16:94:cc:d7:65:11 myemail#myemail.com
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
4) From my application directory: created the path to the server and push the code
$ git remote add origin ssh://me#host/~/git/myapp.git
$ git push origin master
Now I'm being asked to enter my password, after that:
$ fatal: '~/git/myapp.git' does not appear to be a git repository
$ fatal: The remote end hung up unexpectedly
It might be worth noting that this all happens on the same server, a RHEL 5.7. This is something that confuses me because I basically ssh from my server onto my server. But apparently that's how capistrano does it, even if the application_development and the svn repository are on the same physical machine.
# manojlds:
$ GIT_TRACE=2 git push origin master
$ trace: built-in: git 'push' 'origin' 'master'
trace: run_command: 'ssh' 'me#host' 'git-receive-pack '\''/root/git/myapp.git'\'''
Pretty sure you don't want the tilde ~ in the path. I'd put the actual path in (eg /home/users/)
It is possible that using a relative path and specifying the ssh portion is causing it to break when adding origin.
Try something closer to this:
git remote add origin user#myserver.com:/var/git/myapp.git
How do you change the git repository a rail app is pushed to? I know that this is possible because I did it a few weeks back.
Basically I have two very different versions of a app on my local machine. I would like the initial app to still point to the old repository. However, the new version needs to be placed in a completely separate repository.
When I run git init in myapps/old_app/ it puts Reinitialized existing Git repository in /Users/jamespollard/rails/old_repository/.git/
AND
When I run git init in myapps/new_app/ it puts Reinitialized existing Git repository in /Users/jamespollard/rails/new_repository/.git/
However, when I try and git push anything to the repository, it still goes to the old_repository.
Updates
If I enter $ git remote origin set-url git#github.com:mygithub/myapp.git
I get
error: Unknown subcommand: origin
usage: git remote [-v | --verbose]
or: git remote add [-t <branch>] [-m <master>] [-f] [--mirror=<fetch|push>] <name> <url>
or: git remote rename <old> <new>
or: git remote rm <name>
or: git remote set-head <name> (-a | -d | <branch>)
or: git remote [-v | --verbose] show [-n] <name>
or: git remote prune [-n | --dry-run] <name>
or: git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
or: git remote set-branches <name> [--add] <branch>...
or: git remote set-url <name> <newurl> [<oldurl>]
or: git remote set-url --add <name> <newurl>
or: git remote set-url --delete <name> <url>
-v, --verbose be verbose; must be placed before a subcommand
If I enter $ git remote set-url git#github.com:mygithub/myapp.git I get the same error message as above (minus the origin error). In either case, if I run git push origin master it still pushes to the old repository. I've tried adding the new repository again with the same name, but I get a error (which i would expect) saying that it already exists.
Create a new repository in GitHub for you new app, if you haven't already. Make that new repository as origin to your new repository:
git remote add origin <github_url>
If the remote already exists, you might have to git remote set-url origin <github_url>
Now, push to the repo.
I ran into a pretty similar situation few months ago. On the new version of the app there is a .git folder (which was also copied along with all other files when you copied the app). Heroku needs the information from .git to see if anything has changed. So when it 'reinitialized', heroku thinks its the same app.
So here's what I did that resolved the problem.
Copied the entire app folder.
Changed app name wherever they appear (mostly in config folder, google it for a list)
Chang secret.yml file (get a new key by rake secret) or secret token if older version
of rails.
Most importantly, there should be a .git folder in your app folder (it maybe hidden).
Delete that .git folder (it contains git info of the old app)
Initialize a new git, git init
and then commit and push.
Your new app should be a separate app now.
I think this might work if on heroku, worth a try:
git remote rm heroku
git remote add heroku git#heroku.com:yourappname.git
or you can try this
1). open a terminal
2). Go to your_app_directory/.git/config
3). Once you open the config file then edit as follows:
Change
url = git#heroku.com:old_app_name.git
to
url = git#heroku.com:new_app_name.git
Obviously substituting your apps old name to its new name. Hope it helps
If you take a peek at your .git/config file, you see / check that the url is still pointing to the old remote
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = <old_github_url>
so you wish to keep the old remote. let's call that oldremote.
First thing you can do is the rename the remote with :
git remote rename origin oldremote
Now you can add the new remote with :
git remote add origin <new_github_url>
From now on, pushing normally with just git push will push to the new remote. git push oldremote SHA to push to the old remote
remote reference : http://help.github.com/remotes/
I am using Ruby on Rails, the Capistrano gem and git. I would like to do not put anymore under version control some directories that until now I was tracking.
For my application I have a file system structure like the following:
...
.gitignore
/public/aaa/000/001
/public/aaa/000/002
/public/aaa/000/003
/public/aaa/000/...
To accomplish that I aim, I changed the .gitignore file and added to it the following lines:
# Ignoring "/public/aaa/*" directories
public/aaa/
However, if I check what directories are under version control, I see that those I would like to ignore are still tracked. So, when I deploy with Capistrano to the remote server the content of those directories is still changing.
How can I definitely ignore those directories?
In few words, what I would like to do is to do not change public/aaa directories and files on the remote machine (and, thus, to do not track those with git on my local machine) so that when I deploy with Capistrano those folders (on the remote machine) are untouched.
You'll need to remove them before they'll disappear from source control. They're still part of your git repo, so git is going to continue paying attention to them.
git rm -r --cached public/aaa
The -r tells git to remove the directory (just like rm -r in the console) and --cached tells git to leave the file(s), just remove it from the repo.
You could use git update-index --assume-unchanged <filename>. This will keep the files around, but will no longer track their changes.
You can do this recursively with
find ./folder/ -type f | xargs git update-index --assume-unchanged
I have created a brand new heroku app, beforehand i deleted the old .git file from my app's directory and created a new one with the usual steps:
git init, git add ., git commit -m "new git"
all of which worked fine. I then created a new app like so and got the following error:
$ heroku create
Creating glowing-summer-56.... done
Created http://glowing-summer-56.heroku.com/ | git#heroku.com:glowing-summer-56.
git
Git remote heroku added
$ git push heroku master
Counting objects: 1553, done.
Delta compression using up to 4 threads.
fatal: object 91f5d3ee9e2edcd42e961ed2eb254d5181cbc734 inconsistent object lengt
h (387 vs 8985)
error: pack-objects died with strange error
error: failed to push some refs to 'git#heroku.com:glowing-summer-56.git'
This is strange to me, as it is a brand new .git file. How can I get rid of this without cleaning up each damaged object? Is there a way to just delete the git file and start anew? I'm not using this git file for anything other than pushing to heroku.
Also I should note that I am using Cygwin on windows and my git version is 1.6.6.1
I've come across this error before and fixed it, I just honestly can't remember how.
Finally, using git fsck --full yields nothing :(
Thanks,
i seemingly fixed this with: git reset