Change Git Repository Of Existing Xcode Project - xcode

I cloned an abandoned repository from Github, and now I want to be able to upload my changes to a private repo so that a few other people can work on the changes with me. Unfortunately, since I cloned it instead of making a fork, so Xcode is trying to make the commits to the original repo. Is there a way to change what repo the commits are being made to? If there is, would there be a way to change it to a repo on another website (Bit Bucket)?
I fully intend to make the repo public once the changes are complete.

You can do it through UI
Select Source Control Navigator from the left pane
There you can find your current remote repo under the Remotes Folder,
then delete the existing repo:
Now You can add Your Existing Remote
Enter Remote URL

As mentioned in "Git XCode - change origin", you simply can change the remote origin url, using git remote set-url (or in your case, rename+add).
git remote rename origin upstream
git remote add origin /url/of/private/repo
(with the XCode GUI, you could remove, then add again, the remote origin)
If that private repo is empty, you can push to the full history of your cloned repo.
By renaming 'origin' to 'upstream', you keep the possibility to fetch from the original repo, while pushing to your new origin target repo.

Related

How to clone Github repository to local device with Github Desktop

I have a project my friend and I are working on. He made some changes and added them to the project on github. I hit clone on the project in github and then it opened up the github desktop and now I have 1 arrow pointing up and 16 pointing down.
I believe this means I have a non-committed change and 16 changes ready to be pulled, but no idea how to find this change, or if I commit the change will it take away all the changes already on github that are not on local yet?
Just don't want everything to just be deleted. Thanks.
I have a non-committed change and 16 changes ready to be pulled, but no idea how to find this change,
Committed change actually: you have one local commit.
You can:
do a backup of your local repository
make sure you have autostash and rebase in place
then pull through the GitHub Desktop interface.
That is (Git 2.9+):
git config --global pull.rebase true
git config --global rebase.autoStash true

How to upload xcode project into bitbucket from scratch?

I am not able to upload project from Xcode to bitbucket. I have committed but it is not updating.
When you commit your changes in git they are only tracked on your local machine. This means that your local copy is versioned (and you could revert back to a previous version if needed)
If you want others to see your changes, you need to push those changes.
i.e. git push
This sends your commits to a common 'server' where others can retrieve them by performing a pull.
A really good set of tutorials for Git was put together by the folks at Atlassian: https://www.atlassian.com/git/tutorials/
In short, update your local copy before pushing your changes
git pull
Then push your changes:
git push

Add Github remote to GitKraken

I'm using GitKraken (v. 1.4.1) as my Git managing tool. And now I want to use Github as a remote to back up my repos. But when I click on add remote and try to add a Github repo, it just says 'no match'
Does anybody know why this happens? (BTW: I'm using Windows 10, just in case that's relevant)
Here's how it seems to work. If you have a local repo and want to connect it to github, you would use the "URL" option and put in the github address to set that as the remote repo for your local repo. The first time you do a pull or push on a local branch, it will ask which remote branch you want to use and that becomes the remote location to which you will pushing and pulling changes.
The GitHub.com option only comes into play after you have set the remote repo using the "URL" option. If there are multiple collaborators on a project and someone has created one or more forks of the project, then instead of "No Match" under the GitHub.com, you would see a list of all the forks of the project on which you are a collaborator.
You could then add the forked repos as the 2nd, 3rd, etc. remotes, and any activity on those forks would be displayed to you on the commit graph. This allows people to see what's going on in the forks, and you can drag and drop from the forked parts of the graph to create pull requests to the repo you first set up using "URL".
It's a nice feature, but the remote dialog could be labelled more clearly so that people would know the GitHub.com option was for adding forked repos to the commit graph display.
You must always use the "URL" option to add the 1st remote, and then the GitHub.com option only becomes available after that if there are forks to which you have access.
If GitHub is set with your account in GitKraken, you might need to create first an empty repo with the same name as your local repo.
That way, GitKraken can find a matching repo name in your GitHub account.
Or you could select "URL", and enter the right GitHub repo url directly there. Which is what Jim Meyer's answer confirms above.
Note that GitKraken 6.5 (January 2020) will create, then add a GitHub fork repo automatically!
Forking GitHub Repositories in GitKraken
Formerly, users were required to leave GitKraken, go to their hosting service, fork the desired repository, come back to GitKraken, find the related remote, and then find the forked repo. 😅
Now, GitHub users can fork repositories directly through the GitKraken GUI, no more time wasted context switching.
v6.5 allows users the ability to fork GitHub repositories in GitKraken through the GitHub integration.
Simply navigate to the remotes pane in the left panel and click the + button to add a remote.
If you don’t already have a fork on the selected GitHub repository, GitKraken will automatically present you with the fork option.
You will see the message “You have not yet forked microsoft/vscode on GitHub.”
Click the Fork and Add Remote button, and it will fork the repo and add it as a remote to the left panel.
Gitkraken (V3.3.4 64bits on windows) behaviour is strange at this feature level. Same name or URL input doesn't work for me.
So the best and quick way to attach the remote repo to your local is to use the simple Git command line in local repo directory (git#... is your remote URL Github, GitLab...):
> git remote add origin git#...
Gitkraken recognise dynamically it after less than 5 second . Then you can push your existing local files.
Not to add to an old posting but I had the same issue and found this article first so wanted to help anyone else having this issue.
You can get to it by doing the following.
Click the folder icon in the top left corner
Click Clone
Go to the GitHub tab and you will see all your GitHub repos. Clone the one you want and then open it and you are set.

Why is my Git Extensions Graph totally gray and how can I fix it?

I am using Git Extensions with Visual Studio 2010. My repository is on Bitbucket and I am using SSH and PuTTY to push/pull.
When I open my project and click on browse repository, the first thing I see is a window with a message that starts like this (
Along with two buttons for "Edit .gitignore" and "Commit"):
There are no commits made to this repository yet.
If this is a normal repository, these steps are recommended:
-Make sure you have a proper .gitignore file in your repository
-Commit files using commit
If this is a central repository(bare repository without a working
dir):
-Push changes from another repository
My working directory is set (in a drop down) to a local folder on my computer and the current branch is "master" (also in a drop down).
I can push, pull and commit changes and they will show up in bitbucket but the graph does not show up.
There is another drop down on the right side of the Git Extensions window that has "Branches:" as the label.
If I select "master" from the "Branches:" drop down then I see the graph but everything is gray.
I tried deleting my local repository and re-cloning it from bitbucket and nothing changed.
The graph looks the same as if I were browsing a remote repository... all of the branches and nodes are gray.
Also, I cloned the remote repository as a personal repository... not a central one... and when I first created the remote repository I did it as a central repository.
This does not seem to be a common issue... either that or I did not know what to search for on google.
Thanks in advance.
Edit:
The video at this link http://www.youtube.com/watch?v=cFbCusX9bKs created the repository differently than I originally did..... when I tried it that way it worked..... The difference was that you clone a fresh and empty Bitbucket repo to an empty directory as a personal repo then drop all of your project files into that folder and commmit then push to Bitbucket.......
It could be that my problem was that I created a central repo from an existing project and then pushed it to Bitbucket..... I hope this is useful for someone else.
The video at this link http://www.youtube.com/watch?v=cFbCusX9bKs created the repository differently than I originally did..... when I tried it that way it worked..... The difference was that you clone a fresh and empty Bitbucket repo to an empty directory as a personal repo then drop all of your project files into that folder and commmit then push to Bitbucket.......

Updating from a clone repo to the original repo on my server

I'm sure there's something very simple I'm doing wrong here, so I made these diagrams in the hope that someone can figure it out for me. Basically, I cannot get any new files from my cloned repo to show up on the original repo on the server.
Currently, I have a magento installation on my production server. I made this a --bare --shared git repository then cloned it to my local mac git.
I understand how to stage and commit within the clone repository, but I assume this is all local, the commits are contained within the mac's repository and don't actually touch the server.
This is where something is going wrong, now that I have my local repo in the state I want it, do I push it to the original repo?
Then, I assume I will stage and commit the changes on the server?
Last, I realize this is a very basic workflow, but I'd like to master this layout for now before I make things more complex.
Thank you.
After you have stage and committed in your local repo, you have to push to the server:
git push origin master
where origin is the remote you are pushing to ( automatically setup when you clone) and master is the branch you are pushing.
Note that you push commits and not files. So once you have pushed, you are done. You don't have to stage and commit on the server.

Resources