I have a rails app called appname and a remote repo at bitbucket with the same name. I would like to rename it to another_name.
So far, I've tried changing the remote repo's name to another_name, tried git push and it fails. I didn't try renaming the rails app & its folder though, being afraid that something might break.
What's the right step to do this?
If you rename your remote repository, you also have to update the remote's URL in your local git repo:
git remote set-url origin https://new-url-here
You can rename the local folder freely without any side-effects.
Thanks to Agis' answer, this is how I did it:
Rename the repo in bitbucket website to another_name.
Run git remote set-url origin git#bitbucket.org:myname/another_name.git (I'm using SSH instead of HTTPS)
Rename my rails' app local folder to another_name using Windows explorer.
Open up text editor, use the find all feature to find all the files that contain the old name & replace the old name with the new one.
Related
My first project is a rails app written in Cloud9 and pushed to bit bucket and heroku in production.
How do I make an exact clone of this project so that I can rename it and begin working on a second project?
As per this tutorial you should:
Navigate to the repository in Bitbucket.
Click the Clone button.
Copy the clone command (either the SSH format or the HTTPS).
If you are using the SSH protocol, ensure sure your public key is in Bitbucket and loaded on the local system to which you are cloning.
Launch a terminal window.
Change to the local directory where you want to clone your repository.
Paste the command you copied from Bitbucket, for example:
$ git clone ssh://git#bitbucket.example.com:7999/PROJ/repo.git
I'm working on an Xcode project and my brother wants to start helping out. I have the .git folder in my Xcode project directory, how can my brother pull / push / commit to / from my computer? Do I have to use OS X server and put the repo inside of there, or is there a simpler way to do this?
One simple option is to enable "remote login" in sharing, which enables ssh, then you can use the ssh protocol to clone the repository. Remote login preferences will tell you:
To log in to this computer remotely, type "ssh username#computer.local".
username#computer.local will be replaced with your username and hostname. In terminal, use:
git clone username#computer.local:[path]
on your brothers computer to clone the repo to him, where [path] is the path to the folder containing the repository. You will need to enter your password, and you will need to enter it in order to copy changes back later with git push or whatever.
You can set up passwordless ssh with private keys, but bear in mind that by doing this you are effectively giving your brother entire control of your computer.
If you want to push code between two non-bare repositores, I recommend having a look at git-annex.
It is usually used for syncing large files between repositories, but it also contains a nifty way of syncing non-bare repositories (pushes go to synced/master branch that is automatically merged).
Basically, if one can write a ls path or ssh [user#]host:path ls command that would list your repository, then you can use the corresponding git clone [[user#]host:]path [optionalNewName] to clone from it.
Also if he (or you) is working on the same local machine, or has access to the local filesystem, one need only point to either the .git directory or the directory containing the .git directory.
To make clone a repository into another directory:
git clone . ~/2015Archive/repositoryB # copy pwd's repository elsewhere
git clone .git ~/2015Archive/repositoryB # same
git clone ~path/path/repositoryA . # clone other repository into pwd
git clone /home/brother/2015/projects/CoolProject ~/WORK/BrosCode
# with ssh from a remote machine
git clone me#brosmachine:/home/brother/projects/CoolProject WORK/BrosLameCode
git clone me#brosmachine:../brother/projects/CoolProject WORK/BrosLameCode
If you change into the target repository and do a git remote -v it will show you an absolute path to the 'origin' from which it was cloned. If it was a local dir, it will be just a plain, absolute path. If it was accessed through ssh, it will be a ssh [user#]host:path identifier.
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.
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
I just started using Git and I want to know if this is the right way of using it. I started a Rails app with:
rails newapp
Then I did:
cd newapp
git init
git add .
git commit -a
So is it "right" to init my git inside my working directory?
Yes. You can place a git repository anywhere - including the invisible .git directory created by another git repository. I have a friend who has git track all his system config files in case he makes a mistake.
When working on a project, you want to init your repository in the root directory of the project.
To elaborate, each "working copy" of a Git repository is itself a Git repository. If you have a remote copy on a server, that is also a repository. You don't "check out" from there - rather, you "push" your changes and they are merged. If working on a purely personal project, the remote repository is often unnecessary. If you do want to host remotely, Github is a good, free, public choice.
Yep. Looks good to me.
Yes. In a DCVS like git, your working copy is your repository.