Is it possible to create an alias or redirect to a GitHub repo?
For instance, is have the repo org/my-repo, and i want that when i clone the repo org/my-repo-2 (that does not exist), the repo org/my-repo will actually be cloned.
I need it to support a CI/CD process for two separate services that use the same repo, but each one of should be deployed with a different configuration. I want the repo alias to prevent adding conditions to my code.
Related
When we create a pipeline on AWS we can provide a Github repo, let's say the repo name is: "RepoName/exampleProject" and in this repo, we have many folders. So can we provide a subfolder from this repo like "RepoName/exampleProject/subFolder" to repo section in add source stage in AWS?
Since we could have two Folders in this repo like Laravel for the backend and a separate project Vue Js for the frontend.
No. Not for GitHub or AWS CodeCommit. Basically, its a no for any git provider.
What your are providing here is a / and the you provide branch.
These details are required to git clone the source code which will be transition to next stage. When you do a git clone, you clone the entire repository and not any specific folder.
If your source files are on S3, it will be a different case. S3 is not a git based version control. You can download specific folder from S3.
Now while this can be considered duplicate at the first glance, I request everybody to please go through the description.
I want to push to separate Bitbucket and GitHub accounts.
While I understand that we can have a global config (say its the primary account - Bitbucket) and a local config for a repository (GitHub) after setting separate SSH-keys for both, is there a way we could configure multiple email-id's/userNames in the .gitconfig file ?
Note: I have separate emails/username's for the GitHub and Bitbucket account.
Any help would be appreciated.
You can have multiple ssh keys setup for pushing to multiple repository hosting services (like I describe in "Use SSH keys from command line during push for GitHub?")
But if you want to push to GitHub and Bitbucket from the same local repo (one commit, 2 pushes), then you would need to chose one username/email for your commit, which can only have one set of author/email metadata associated to it.
If you are pushing from different repo, then yes, each one can have its own local Git config setting, with different user name/email.
In github, my account can access multiple related repositories. A user story can be implemented as same-name branches in multiple repositories.
Given a branch's name, can I find out which repositories contain a branch with the given name?
Can I further jump to such a branch in a given repository?
Probably the simplest way of searching repositories for branch names is to use the command git branch within each repo. You can specify git branch -a for local and remote branches, or git branch -r for just remote.
This isn't ideal for a number of reasons, one being that you'd need to have command-line access to all the repositories you want to search (such as all the repos being cloned locally), another being that you'll have to manually scan through the branch list that git branch outputs.
One possible solution to this is to use the GitHub API to list all repos and / or all branches. The answer here gives a decent example in Python of how to authenticate (to allow access to private repos), which you would need to follow with the API's GET request:
GET /repos/:owner/:repo/branches
I have two github repositories to manage the same project at first.
Then I make some changes in one repository files.
How can I do to make the changes to another repository?
The two repositories are independent of each other,not the master and branch relationship
Thanks
One solution (for GitHub repo or any two repos), would be to isolate your changes in a patch, and apply to your second local clone of your second GitHub repo.
See as an example:
"How to apply a git patch from one repository to another?".
"git: Apply changes introduced by commit in one repo to another repo"
How do I create a github mirror for an external git repository, such that it appears as "real mirror", e.g., as in https://github.com/mirrors?
So far, I set up a mirror using:
cd /path/to/bare/repository
git remote add --mirror github git#github.com:user/repo.git
and configure the post receive hook to do a git push --quiet github. This way, however, github does not recognize the mirror.
Any ideas how to do it the github way, such that "Mirrorred from" appears underneath the repostiory name?
Based on communicating with GitHub's support team, I found that GitHub currently offers no direct mechanism for a user to mirror repositories in this fashion.
However, one can ask GitHub to install this service for repositories which are part of an organization. GitHub then configures an existing repository as such a mirror and pulls from it in an interval that is a function of the number of overall mirrors they have.
EDIT: as Stuart points out, GitHub no longer accepts requests for mirroring arbitrary repositories. The only remaining option is the solution I posted in my question, i.e., creating a post-receive hook to automatically push to your GitHub repository.
Judging by the current content of https://github.com/mirrors, it would appear GitHub no longer does "official mirrors", as most projects that want their code mirrored on GitHub today just makea an organization for it, such as Git itself.
There is also a feature request at: https://github.com/isaacs/github/issues/415
According to Importing a Git:
For purposes of demonstration, we'll use:
An external account named extuser
A GitHub personal user account named ghuser
A GitHub repository named repo.git
The command line:
# Makes a bare clone of the external repository in a local directory
$ git clone --bare https://githost.org/extuser/repo.git
# Pushes the mirror to the new GitHub repository
$ cd *repo.git*
$ git push --mirror https://github.com/ghuser/repo.git
# Remove the temporary local repository.
$ cd ..
$ rm -rf repo.git
I have used a tool called github-backup with moderate success to, if not mirror, at least make a full backup (including issues and other metadata) of a Github user or organization. To quote the README file:
Each time you run github-backup, it will find any new forks on GitHub. It will add remotes to your repository for the forks, using names like github_torvalds_subsurface. It will fetch from every fork.
It downloads metadata from each fork. This is stored into a branch named "github". Each fork gets a directory in there, like torvalds_subsurface. Inside the directory there will be some files, like torvalds_subsurface/watchers. There may be further directories, like for comments: torvalds_subsurface/comments/1.
You can follow the commits to the github branch to see what information changed on GitHub over time.
The format of the files in the github branch is currently Haskell serialized data types. This is plain text, and readable, if you squint.
Limitations include:
no private repository support
no "social" stuff like stars, followers, etc
notes to lines of commits are not supported (yet?)
issue labels