git: export from bitbucket and import github (w/ commits) - ruby

I created a private git repo on bitbucket and committed code.
Now I want to export all (commits, code, history) and import it in a git repo on github.
Is there a way to do this?
Thanks

Check everything out locally to your computer and git pull.
Create a github repo
Add this repo as your second remote ("with git remote add github URL")
Push to the second remote

Related

Push current code to existing GitHub repository

I have several Visual Studio solutions that have both a local repository and one on GitHub. I've already made many changes and successfully pushed those changes to GitHub.
But now Visual Studio has forgotten that one of my local repositories is associated with a GitHub repository and I can't seem to figure out how to reconnect it. In fact, it no longer lists that repository in my list of GitHub repositories.
In the image below, you can see I have a local repository called Toxic, but that repository does not appear in the list of GitHub repositories. If I try publishing the Toxic project to GitHub, it just tells me the repository already exists.
How the heck can I get all of my existing Github repositories to show up in the top section shown above so I can push my latest changes?
it appears the only option is to clone the GitHub repository locally, copy my modified files over the newly created repository, and then check in my changes.
Try fist:
installing Git for Windows (command-line)
cloning your remote repo in a new folder
adding your existing repository as a remote
fetching and see if you can cherry-pick your commits
That is:
git clone https://github.com/<user>/<repo> newFolder
cd newFolder
git remote add old ../path/to/old/local/repo
git fetch old
git log old/master
git cherry-pick old-sha1..old/master
(with old-sha1 being the first commit you want back)
Then add the newFolder in your Visual Studio workspace, and see if everything works (do a modification, add, commit and push)
Unless I'm missing something, it appears the only option is to clone the GitHub repository locally, copy my modified files over the newly created repository, and then check in my changes.
Of course, I lose all my comments and iterations since the last check in to GitHub. And care had to be taken not to delete the .git folder, and to copy over all changed file and delete any that had been removed. Seems like there should be an easier way but this certainly did the trick.
I'm no git expert, but I think I might be able to help, if I'm not too late.
Run:
git remote -v
This should print something in the form of:
origin <remote_repo_url> (fetch)
origin <remote_repo_url> (push)
If you only see:
origin (fetch)
origin (push)
try running:
git remote set-url origin <remote_repo_url>
If you get no output then run:
git remote add origin <remote_repo_url>
And then try
git push -u origin
The -u or --set-upstream flag will set origin as the default repo for your branches.

how to migrate git to gitlab migration with history (existing branches and tags)

I setup the new fresh GitLab server and i want to migrate my git repositories to gitlab server. I am following below steps but i am getting the error.
git clone --mirror Git repo URL
git remote add NEW-REMOTE Git Lab repo URL
git push NEW-REMOTE --mirror
finally it through an error
remote: fatal: Error in object
error: pack-objects died of signal 13
any help would be appreciated.
I believe gitlab has it's own git import tool built into the interface. When creating a new project you can import an existing git repo with it. Any history and branches will be included.
screenshot:

"Github.com" go packages not showing in remote repository in Bitbucket

When I push my go code into my remote bitbucket repository, I don't see my files in github.com package folder instead I see this (this is a screen shot of my bitbucket repository, where I expect to find my go files):
I used this command to push my code into my remote repository:
git add .
git commit -m "message"
git push -u origin master
When I log into my Bitbucket account, I expect to see my go files inside the "drakecheckin/src/github.com/coopernurse" directory. However I do not see my go file instead I see an arrow pointing to a bunch of characters+numbers.
Go get will clone github repositories into the appropriate folder of your gopath. What you're seeing in BitBucket is a submodule. You can treat the folder as a subtree if you'd like to check it into version control.

clone a fork project in bitbucket

I am new to bitbucket. I am reading bitbucket documentation to learn it. I am at the fork concept. In fork documentation they provide a tutorial how to clone fork repository to my local machine. The tutorial is using the TortoiseHG Workbench. I have forked the external repo to my repo. Now I want to clone my fork repository using git bash because I already clone a git repo. I am unable to clone a fork repo using bit bash. Is fork repo only cloned using TortoiseHG Workbench or there is also a command for cloning.
I am using these commands for cloning my fork repo.
git clone git#bitbucket.org:user/myqoute.git
the error is
conq: not a git repository.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
First, you need to fork (meaning make a clone on the BitBucket side) a Git repository, not a mercurial one like tutorials/tutorials.bitbucket.org.
Use for instance tutorials/online-edit-starter.
Then you can clone that fork with:
git clone https://bitbucket.org/yourUserName/online-edit-starter.git
(using yours BitBucket credentials: username and passwords)
Or:
git clone git#bitbucket.org:yourUserName/online-edit-starter.git
(provided you registered your public ssh key in that repo)
How to clone Repository ? (proposed by Rajesh Chaubey)
First take of fork repository:
git clone https://rajeshchaubey87#bitbucket.org/rajeshchaubey87/uispark.git
(copy your repository url.)
(then go to your master folder).
cd uispark
git remote add upstream https://animatorstar#bitbucket.org/animatorstar/uispark.git
git fetch upstream
git merge upstream/master
git remote -v
git status
git add -A
git commit -m "your comment here"

How to Set Up Xcode with Remote Git Repository

so I just installed a new remote git repository on one of our servers and want to move our old projects there. Our existing projects have local git repositories, and we can add repos from the server, but how do we move our existing projects onto the server?
Any ideas?
You would do these steps:
Make the individual repositories on the server.
git clone --bare nameofrepo
On the actual repo, add the remote to the repository from which you want to send up work:
git remote add origin <url to your remote>
Now push your branch for your work:
git push origin master
Repeat for any other branches you want to have pushed to the central repo.
The URL in the first command can also be a regular file path. Most solutions, however are through an SSH connection.
After creating your Xcode project, cd to that directory
and make sure you are on the master branch
Type:
git remote add origin <URL-of-your-GitHub-repository>
git pull
git branch --set-upstream-to=origin/master master
git merge
git commit -m "Merging with remoteā€
git push
Now your new project has been pushed to the remote GitHub directory.

Resources