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
Related
I have Selenium project and i want to run my job on local Jenkins 2.176.1 from local repository (using path to my project folder on disc).
Do You know where's that option? I remember that I use this option few months ago, but now I can't find box for path to files on disc.
Now I only see git/subversion option.
[]
Linking-jenkins-local-git-repository.
Go to Source Code Management tab and select Git
The critical part is what you enter here as the “Repository URL”. The correct value should start with file://// for a local repository which is created on your PCs local file system.
For a test project which was created under “/usr/local/projects/reporting-servicet” the Repository URL should be entered as “file:////usr/local/projects/reporting-service”.
Now save this configuration, go to “Jenkins” dashboard (http://localhost:8080/) and click your projects name on the right
#Sunny Sharma's answer works well for a local git repository. I setup a Multibranch Pipeline Project, added the following into Branch Sources > Git > Project Repository
file:///<path-to-local-git-repository>
or simply w/o file:///
<path-to-local-git-repository>
Where file:/// or file://// both are working for *nix style forward slash path. Even though you're using a local git repository, any changes you made needed to be committed locally first in order to let Jenkins check out and pick them up. Validated on Jenkins 2.263.4.
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'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.
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.