The full repository url could be something like:
https://redpelle@bitbucket.org/redpelle/myproject.git
BitBucket suggests this procedure in order to add files to your repository (that is my case didn't work):
BitBucket procedure:
cd /path/to/my/project git remote add origin https://redpelle@bitbucket.org/redpelle/myproject.git git push -u origin --all # pushes up the repo and its refs for the first time git push -u origin --tags # pushes up any tags
Instead of that, here is the procedure that worked for me (type from command line).
Correct procedure:
cd /path/to/my/project git init git remote add origin https://redpelle@bitbucket.org/redpelle/myproject.git git add -A git commit -am "Fist commit" git push origin master
This allows you to go to your directory, init the git environment is that directory, add the remote origin, add all files to git, in order to let them get versioned, commit all changes, with a message "First commit" and then push all these files on remote repository.
If you already have files in remote repository, when pushing an error could be thrown, like this:
From https://bitbucket.org/redpelle/myproject * [new branch] master -> origin/master There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pullIf you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/ master
In this case you can just run the command:
git branch --set-upstream-to=origin/master master
fatal: refusing to merge unrelated histories
It can be caused by the presence of a .gitignore file. In this case you can run:
git pull origin master --allow-unrelated-histories
then you can manually solve the conflict or, if you want to solve conflicts by keeping remote version of conflicting files, you can run directly:
git pull -X theirs origin master --allow-unrelated-histories
then you can push again:
git push origin master
No comments:
Post a Comment