How do I set up Xcode source control so that my repository can be accessed by two MacBooks? - xcode

I have managed to set up Source Control locally on my MacBook (let's call it MacBook1) without any problems.
I would like to set up another MacBook (MacBook2) to access the same repository (the one stored locally on MacBook1). Basically I want both machines to be able to work on the same project at the same time and use MacBook1 as the Git repository and source control server (for lack of a better term).
I've tried clicking on my Wi-Fi status icon and Create Network, but when I do this I can no longer access the internet through Wi-Fi. Also my Git folder for my project is a hidden folder and I cannot seem to select it for sharing.
How can I share my MacBook1 local Git repository across 2 machines?

If you want to keep the repo private then use bitbucket.org, however if you want to make it public then use github.com.
I use bitbucket even though I only generally use one Mac for development as I figure their data handling standards are better than mine and I am less likely to lose data due to disk crashes etc.
You basically create an empty repo on bitbucket and then in your local working repo, do:
$ git remote add origin https://bitbucket.org/YourName/YourRepo.git
$ git push --all
$ git push --tags
(I am not associated with Atlassian).

Related

Create remote git repository on Windows machine from Pi

I have a project I built on a raspberry pi, including a git repository. I'd like to make it that when I type git push, it would push to my windows machine (I've had an SD card fail on me in the past, and it cost me lots of code, so I'd like an external backup). I've tried many tutorials, all of which fail due to some reason or other. My latest, is I'm trying to follow this one
I have a windows 10 machine. I went to Control Panel, System and Security, System, and copied the computer name from Computer Name (DESKTOP-UFCQ4N8).
I created a folder called f:\Shared\Git\thermostat. In windows explorer, I right-clicked on here, selected Properties, Sharing tab, and then clicked Share. I added Everyone to users, and clicked share
I then did:
f:\Shared\Git\thermostat>pushd \\DESKTOP-UFCQ4N8\thermostat
Z:\>mkdir MyGitRepo1
Z:\>cd MyGitRepo1
Z:\MyGitRepo1>git init --bare
Initialized empty Git repository in Z:/MyGitRepo1/
Z:\MyGitRepo1>popd
I finally try the following:
pi#raspberrypi:~/devel/thermostat $ git remote add origin file://DESKTOP-UFCQ4N8/thermostat/MyGitRepo1/
pi#raspberrypi:~/devel/thermostat $ git push origin master
fatal: '/thermostat/MyGitRepo1/' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
pi#raspberrypi:~/devel/thermostat $
But it does not seem to recognize the repo. I've spent quite a bit of time playing with different permutations of this, but can't seem to figure out what I'm missing. Does anyone know what I'm doing wrong?

How do I stop OneDrive from downloading git.exe on Windows?

I have used Git on Windows for a while, but recently changed the setting and got this.
On almost every command for Git Bash (also on PowerShell and Github Desktop) I get
git.exe is being downloaded on OneDrive
(translation may not be exactly the same)
The setting that changed recently is moving my repos to a OneDrive folder in order to have them synced between two sessions: that is work desktop and remote virtual machine.
I can see that this may not be ideal, but it really works for me since I have the same settings on both sessions, and not really get used to doing many commit-push-pull. Not the main topic here, but feel free to comment.
(Edit): Upon reading solution, there are other ways to set this syncing that doesn't mess up with the internals of Git. Look for that instead. Thanks.
In any case, the strange thing is that the notifications happen only on the Remote Virtual Machine, but not on the desktop.
I have seen some notifications about some files in the repos, which I then attribute to OneDrive being nosy about every move I make file I move. But then I've also seen files I don't know about, and theres always git.exe attached to the notification.
In the first scenario I have tried tuning down the notifications for OneDrive. Some might say Microsoft does have a background for not letting users setup their notifications, so I'm still looking.
Thanks.
Most file syncing tools like OneDrive and Dropbox operate by syncing data file by file. This is a great approach if you're working on a single word-processing document or spreadsheet. However, it's not as great when you're working with a Git repository.
When changing between branches or making a commit, Git changes and creates a lot of files all at once. In order to be synced correctly, all of the created files must be written in a similar order: all the blobs must be written, then the trees, then the commits, and then the refs can be updated. If you do this out of order, your repository can be corrupted, since you can have branches that refer to objects that don't exist (or objects that refer to other objects that don't exist).
In addition, these tools can end up deleting files you wanted to have in your working tree or recreating files you didn't. So overall, you don't want to sync any Git repository using one of these tools.
You can write a bundle file with git bundle and sync that, or you can use rsync to sync a repository provided it's idle (not being modified) when you do. Note that if you sync a working tree, Git will need to refresh all files when you sync it across to the new machine, and also Git doesn't try to defend against untrusted users who have access to the working tree.
It's also not a good idea to sync your Git installation itself via OneDrive, which is what it sounds like might be happening. Instead, install Git for Windows on each machine independently and don't try to sync it across. OneDrive should have configuration options that let you control what's synced.

How to create a git repository on a shared windows machine which all developers can push to

I have created a bare Git repository on a shared windows machine on a local area network. I am experiencing a problem in which nobody else but me is able perform a push operation. When trying to sync with or push to the remote repository using the Visual Studio 2013 Git tools, other users receive an error reading "Opening repository: .The following errors were reported during push: refs/heads/master, Failed to rename lockfile to '/refs/heads/master': Access is denied." There seem to be a lot of similar questions about creating a shared repository on stack overflow though none of them have given me the right solution for my problem. One thought is that I may need to create a repository user group, perhaps based on our domain user groups, though I do not have any idea how to do this with Git on Windows and have not found any resources for instructions as of yet.
You can share the folder that contains the bare git repository, and just add those Windows users as people who can read and write to those folders. After making a folder "shared" Windows should tell you what the network path should be. Then it's a simple git clone file:////MACHINE_NAME/path/repo.git.

Missing/corrupt object file errors when using Git repository in Windows 8.1 Skydrive

I like to keep my local Git repos in my Skydrive folder so they sync nicely between machines and I always have an online copy. However, I've recently run into problems after upgrading from Windows 8 to Windows 8.1.
Specifically, I started getting errors that [hash] object was missing or corrupt. After debugging the issue, it turned out that Git was having difficulty with 8.1's new Skydrive integration into the file system. Specifically, 8.1 likes to list files as if they're stored locally, but keep them online until they're accessed. It turned out that right clicking my repo folder and clicking 'make available offline' solved the git errors.
Is there some convenient git or windows setting that I can change to make this unnecessary? It's not a big deal to make files available offline (in fact, I'll probably do that anyway), but I'd like to know if there's a neater solution.
You don't keep a git repo in a synchronized folder (Dropbox, SkyDrive, ...): too many files, too many corruption possibilities.
What you keep is a bundle:
one file
which can be incrementally updated,
and which represents your git repo
and from which you can clone a local repo
See:
"Git with Dropbox"
"Using Dropbox to synchronize files and having them backed up in version control"
"Git with Dropbox Issues"
Or, you can push those repos to a private repo hosting service like BitBucket, as commented by ta.speot.is.

How do I use Github to access the same project files from different computers?

I work mainly on a desktop Mac but also have a laptop Mac that I use when away from the office.
I want to access and work on my latest html, css, php and python files from either computer.
I thought Github was the way to do this but am having a problem understanding the "flow" and I've RTFM! I don't understand whether I should create a Repository on Github first, why when I try to "clone" something it doesn't magically end up on my local computer... where the nice big red button that says "sync" is...
... or whether I should just use the commandline ONLY...
So, if I start on my desktop and create new files, what are the correct steps using git or Github (?) to put those files where they can then be accessed from my laptop and then have the files on my laptop merged back into the ?Github repository so I can then access those files from my desktop.
Thank you all for your replies and answers! The git workflow, for my needs, is now clear.
The workflow presented by wadesworld is concise and was the overview I needed.
However, Michael Durrant's commandline steps filled in that workflow specifically with commandline directives - and I needed that also.
steelclaw and uDaY's answers and responses were important because I did not understand that it did not matter which repo I created first and, adding and committing locally were essential first steps in my workflow.
Specifically, steelclaw's response to one of my response questions provided the closure I needed, so I could learn more:
After initializing the repository, be sure to use 'add' and 'commit.' These will make the files an official version of the repository. After that, you need to use 'push' to upload it to the remote repository."
ilollar's resource, "Git for Ages 4 and Up" is also worthy of the click, especially for folks like me who are visual!
Thank you all so very much!!
Do you want to version control your files or just have access to the same files in both places?
It is a good idea to use version control as a developer, whether you're writing code or designing websites. But, to do so, you have to have a commitment to learning how version control systems work, since they all have some learning curve.
But, if you're not interested in that complexity and simply want to be sure you have access to the latest version of your files, then you're looking at a file syncing operation which can be much more simple.
So, which one do you want?
Edit: Based on the response, here's the model:
1) Create repository on work computer.
2) Create repository with same name on github.
3) Push to repository on github
4) At home, do a git clone to pull down the changes you pushed.
5) Now that the repository exists in both locations, you can simply do a git push before you leave work, and git pull when you get home, and vice-versa when going the other direction.
To answer the detail of your question: I'd go with Dropbox.
UbuntuOne is also good even for non Ubuntu users and of course Google drive is the (big) new player on the block.
They compare as follows:
Service Free*1 NextLevel*1 NextLevel($)*2 Features
Dropbox 2 50 $2.5O One Folder, best gui sync tools.
UbuntuOne 5 20 $4.00 Multiple directories anywhere
GDrive 5 25 $2.50 It's Google.
*1 GB
*2 Cost per month
To answer the title of your question:
If you wanted something that's more suited to programmers, I'd use git:
First, install gitx (linux readers, that's gitg) as that is by far the most popular gui for git:
For the "flow" I can also refer you to my write-up of various features at:
What are the core concepts of git, github, fork & branch. How does git compare to SVN?
Using gitx or gitg the specific flow is as follow:
1) Make some changes to files.
2) Use the tools "commit" tab to see what's changed ("unstaged"):
3) Add a file by dragging it from "unstaged" to "staged":
4) Give a commit message
5) Commit the file.
6) I then push it to the remote at the command line with $ git push remote or I use the gui by right clicking and select ing the 2nd master - see here:
.
If I'm sharing with others I'll often need to do git pull to get ands merge in others chnages) before being able to do a git push
The github part is doing init and push and clone but I'd say just read up on those tutorials more rather than an SO question. Basically though, I do:
Set up repository locally in git:
git init
git add .
git commit "Initial commit"
Set up github:
Create a github repository using github (https://help.github.com/articles/create-a-repo)and then push your local repository to it as in:
git push origin master.
If the repository already exists on github but not on your local pc, that's wheh you click the remote link and then in a terminal type git clone [paste here, e.g. ctrl-v]
If you're "starting" with github:
Make code changes
git pull - get latest version into your repository and merge in any changes
git add . Add all modified files
git commit -m "message"
git push # origin master is the default.
If, at the end of the day you decide to go with something simple like Dropbox you can use my referral link -http://db.tt/pZrz4t3k- to get a little more than the standard 2GB, Using this we both get an extra 0.5 GB, however which of all these routes to go is up to you and your needs. I use all these services (git, github, UbuntuOne, Dropbox and googleDrive, so I am not recommending one over the others -it depends on the needs).
I would recommend using DropBox or Google Drive. They will let you do EXACTLY what you are trying to achieve, they are very user friendly (and free [5 Gb I think]).
They automatically update (as long as you have an internet connection obviously)
Just make a folder, put some files in it, and you are away.
Since explaining how to use an entire VCS in one answer is an overwhelming task, I can instead point you in the direction of some very helpful resources to get you to understanding and using Git:
Pro Git - a free online book (written with Git!) with easy language on all things Git.
GitHub Help - GitHub's own help section walks you through setting up and using Git, and not just with their own apps. Very useful.
Get Started with Git - A good tutorial getting you up and running with Git.
Git For Ages 4 and Up - Fantastic video explaining the inner-workings of Git with Tinker Toys. Not best for an introduction into Git, but a great video to watch once you feel a bit more comfortable.
Git may feel complicated or strange at first, but if what you are looking for is a good version control system, it is excellent.
However, if all you're looking for is a cloud-like service to sync some files across multiple computers, like the others have mentioned, Dropbox would be the way to go.
I use Github as a "hub" of git, to share finished codes. (And Git for version control)
And Dropbox to sync files between different computers and mobile/tablet, to manage files.
http://db.tt/EuXOgGQ
They serve different purposes for me. Both are good!
Git is an advanced and rather difficult tool to use for version control. If you're feeling brave, you can try to install the command line tool, however I recommend using a graphical client, specifically SourceTree.
http://www.atlassian.com/software/sourcetree/overview
You'll need to clone your repository, or else initialize a new one. To connect to your repository, you'll need to know the URL, and possibly a username and password for your repository. You also need to provide a valid name for the repository.
To update files there are several steps: First, you need to add the changes to the directory. Source tree might do this automatically. Then you need to commit the changes. This is basically confirming changes and signing them with a comment. To upload them, you need to use push and select the correct remote repository. When you want to update your local repository, you'll need to use pull and again select the correct remote repository.
For your purposes, however, it seems like dropbox might be better, because it automatically updates and is very simple. If you don't need the advanced version control that git provides (e.g. branching, merging from many users), then it seems like it would be a better option for you.
https://www.dropbox.com/

Resources