Hi i have my application source code on github, now i want to upload it to my server. Should i first run rails new blog and then do a git init and git pull? Or do i have to create a folder manually, do a git pull to it and no need for rails new blog command?
first you want to git clone that repo from git hub
git clone blaa#github.com/blaa
once you get a folder created, go there and try doing
bundle
once that's done and once your dependencies are resolved, you can start the server
rails server
Related
I created a project using angular cli. Project is in directory dw-ng2-app and it has several files generated by angular cli. I want to create a Bitbucket repository for this. My confusion is, when I create a repository in Bitbucket, it gives me 3 options
I create a README and .gitignore file. I cannot use this option as
then when I try to sync the local project with repository, I get
error that there is no common history
I selected option of starting
from scratch. The web page listed the commands I should run to clone
and upload, eg git clone git#bitbucket.org:username/angularcli.git
but this creates a new directory on my local machine named
angularcli which has .git directory. I am not sure if I can use this
option as my project is in different directory and moving it to
angularcli directory might affect it (not sure)
3rd option is to
mention that I have an existing project. Then I am prompted to use
the command git remote add origin
ssh://git#bitbucket.org/username/angularcli.git but that doesn't
work as my current project directory is not a git repository
How can I move the angular cli project to bitbucket? Should I have created the repository first and then created angularcli project in the generated directory?
There are a couple of ways to do this, but the simplest may be to simply make your current project directory, a git repository.
Go to your project directory
cd dw-ng2-app
Initialize git repository
git init .
Add your current project to be tracked
git add --all
Make your initial commit
git commit -m "Initial commit for Angular project"
At that point, you can use the third, "existing project" option within BitBucket.
After you've created a new repo there, you can see its URL and use that to track your new repository with your local one
git remote add origin https://username#your.bitbucket.domain:7999/yourproject/repo.git
git push -u origin master
[Here's a complete writeup from BitBucket if you need.][1]
note - I used git add . originally in my example, and BitBucket recommends git add --all. Either of these will work fine in your case.
[1]: https://confluence.atlassian.com/bitbucketserver/importing-code-from-an-existing-project-776640909.html
If you've created project using angulat-cli then it automatically created project with git initialisation. It also commits initial changes locally.
So you just have to add remote origin and push the content.
-If repository is not initialise as git repository then:
cd dw-ng2-app
git add --all
git commit -m "commit message"
git push -u origin master
-If already initialise with git repository.
First of all go to directory dw-ng2-app : cd dw-ng2-app
add remote to your repository.
git remote add bitbucket https://username#your.bitbucket.domain/yourproject/repo.git
push the changes:
git push -u origin master
here's master is name of branch in which you want to push the content.
I have a rails app that on my local development machine and I want to copy it and have a sort of starting point in case I don't want to start over from scratch later for future projects. Is there a rails command I can use to "clone" it or should I simply copy and paste the directory?
There is no rails command to clone your app. But you can install git on your system and create a git repo to do what you want easily. To do this go to your rails app root and execute
git init
git add .
git commmit -m "Your commit message"
You can then continue working and commit your changes as needed or discard all or individual changes. You can also clone your app with the git clone commmand.
Update: I couldn't get either of the first two solutions provided to work, so I'm providing more detail and setting a bounty.
I have previously forked a github project called Enki (a Rails blogging platform) and then customized it and deployed it on Heroku.
Now I want to start a new Enki blog. I can't fork Enki again, because it's already forked and customized for the first blog. I now cloned it from the author's page, and wanted to add a new repository on my github page so that I could deploy it to Heroku. Here's step by step instructions that I followed
git clone https://github.com/xaviershay/enki.git valentines
cd valentines
git checkout -b myvalentines
bundle install
cp config/database.example.yml config/database.yml
git init
Message
Reinitialized existing Git repository in /Users/mm/Sites/valentines/.git/
1) Why the existing repository? Did I do something wrong? So it's going into the same repository (as the original fork?) even though I've named it something else?
Made code changes then did
git add .
git commit -m "made code changes"
2 files changed, 193 insertions(+), 157 deletions(-)
rewrite Gemfile.lock (70%)
2) Does the fact that it's writing Gemfile.lock mean that it's not changing the branch but rather the master?
Next I created a repository on GitHub
git remote add valentines git#github.com:Username/Valentines.git
git push valentines master
As you can see I, following Ksol's suggestion, used a different word than origin but it didn't work 3) Problem - the GitHub repository 'Valentines' did not show the code changes that I made, but was rather the original gem
Just use another name for your remote than origin?
Adding to #Katen's answer:
You can also use branches for this. For example, your forked repo could contain these branches:
master (pristine code from the author's repo. You may periodically update this)
blog1 (your first blog)
blog2 (your second blog)
This way, to begin working on new installation and customization of this blog engine, just run these commands.
// assuming that you completed and committed your work on a current branch
git checkout master // switch to original code
git checkout -b blog3 // "fork" it to a new branch and switch to that branch
1) git clone will point to the original repository, regardless of the local directory you place it into to. You created a new branch w/ git checkout -b, but it's not a new git repo
2) This looks normal, rewrite is just telling you that you made a lot of changes to that file.
3) I believe this is because you didn't push the new branch to your github page
git push valentines myvalentines
you can also update your .git/config file so origin is your new location. Similarly, there's no reason your master branch need be a copy of the enki master branch, but you should keep a reference to it so you can pull future updates.
Our team is working on an app. We have a SVN based app. We also pushed the app to heroku. The other day the app was pushed by one member of the team, and after a couple of days of work and making some updations other member wants to push his data on heroku in the same repo from another machine. How can this be done?
Please Help.
Thanks in Advance.
You need to use Git to push applications to Heroku. If your source control of choice is Subversion, then you can use git-svn to deal with a Subversion repository using Git, including pushing to Heroku.
You need to add a git remote to the Heroku Git URL. You can find this URL in your Heroku account at heroku.com.
# stuff about setting up git-svn
$ git remote add heroku #{heroku_git_url}
$ git push heroku master
As another commenter mentioned, you will also need to manage SSH keys. The user doing the pushing will need to have an SSH private key (you can look up ssh-keygen) and will need to have the SSH public key uploaded to Heroku (heroku ssh subcommand).
So if your app is deployed and you already have a working copy. And you need to push changes.
You only want the repo with no content.
git clone --no-checkout git#heroku.com:<your-app-name>
That will clone the repo into a directory named your-app-name, and in that directory will be the repo you want. Move that .git file next to your .svn file.
mv <your-app-name>/.git ~/Code/<your-working-copy>
rm -rf <you-app-name>
You can rename the origin remote to heroku if you want. Otherwise just
git commit -am "Deploying v1.2"
git push
My rails app is in a svn repository, but several of the plugins are installed through git and later added to the svn repo. How can I update these plugins? I can't seem to get script/plugin update to do anything. I'd really like to update activemerchant to get rid of the Inflector warnings.
If you haven't made any local changes to the plugin and you don't need to track what changes to it the update will bring, you can just run script/plugin install again, passing in --force if you need to. For example:
script/plugin install --force git://github.com/dchelimsky/rspec.git
If you already have a static copy of a plugin checked into Subversion, it can be a pain to update it via script/plugin, so here's what I end up doing in order to switch it from a static install to a Git checkout all within one Subversion commit:
git clone git://github.com/foo/bar.git ~/foobar
mv ~/foobar/.git rails_app/vendor/plugins/foobar/.git
rm -rf ~/foobar
cd rails_app/vendor/plugins
git reset --hard
Then make sure to add .git and everything else that has changed to the Subversion project and you will be all up-to-date. You can use other git commands to pull down updates, move to a different branch, etc. Then just check things in again once they are at the state that you want.
One thing I do in this case, I remove the plugin directory then I commit to SVN, this will remove the old plugin in the repo. (I usually moved it in a tmp directory, just in case and delate it later once the new one is working fine)
I then reinstall the new version of the plugin, and commit again.
Easy.
You should just be able to navigate to the plugin's directory and hit:
git pull
. I'm pretty sure that script/install plugin just checks the code out from the git repo.
In order for Git to be able to recognise the repository as a Git repository, you will need to add the .git subdirectory and everything under it to Subversion as well. Otherwise, the plugin will just look like another pile of source code and Git will say it's "Not a Git repository".
Ran into the same situation and used this solution: had paperclip installed as a plugin sitting in an svn repo as part of my app. Now I wanted to use the latest version instead and didnt change a bit of the paperclip plugin so I could easyly remove it from the app/svn and install it as a gem instead. done.