clone a fork project in bitbucket - fork

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"

Related

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:

Reinitializing a git repository

I have an xcode project on my desktop in a directory that originally had a git repository with a tracking branch that tracked a remote branch on github. The remote branch has some 84 commits and is 2 commits ahead of the master branch of the project I'm adding features to. I changed the name of the folder/directory on my desktop. I'm not 100% sure if this is the reason why but when I go to git status I get: fatal: Not a git repository (or any of the parent directories): .git. My plan is to simply git Init, add the remote branch and create a new tracking branch and than commit locally to that branch and than push to the remote branch. However, I'm a git beginner and I'm not sure if this is the proper way to go about it. I'm very weary of losing any commit history or accidentally breaking something. Is the method I outlined a good way of rectifying this loss of the git repo?
If you have all your code updated in remote repo then your local .git is deleted. You don't need to re-init your local repo. Rather just clone it.
git clone remote_repo
If you don't have any commit in remote repo, Simply follow
git init
git add all_local_files
If you have updated remote repo than some commits made in local but not pushed and you lost .git. Simply clone remote. Add all files in a single commit
git clone
git add all_local_files
Looks like you messed up your git repository, but not the code / contents.
One way to restore and keep local changes ( if any ) would be:
Clone another copy of your repo from github.
Copy all modified files to the new repo, omitting removed ones: rsync -duztv /old/local/repo/ /new/local/repo
git status to see what the situation is.

how to push a single java file to a remote repository

I am new in git and want to push some java files to remote github repository. The files are NOT a project, just some algorithm problems that I want to share on github.
When I tried git push the alert fatal: not a git repository: .git
Is there any quick way to push some/single file to repo using git bash? thanks
One solution would be to do a git init . in the folder whare your files are.
Then add the github repo as a remote:
git remote add origin https://<yourLogin>#github.com/<yourLogin>/<yourRepo>
git add .
git commit -m "My first files"
git push -u origin master
The other approach, especially if the remote repo on GitHub is not empty (because of README and LICENSE files), is to clone that repo:
git clone https://github.com/<yourLogin>/<yourRepo>
cd <yourRepo>
# copy your files there
git add .
git commit -m "My first files"
git push -u origin master

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

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

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